tessl install tessl/pypi-googletrans@4.0.0An unofficial Google Translate API for Python providing free text translation and language detection capabilities
Agent Success
Agent success rate when using this tile
100%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.01x
Baseline
Agent success rate without this tile
99%
Build a translation service that works across different deployment environments with configurable translator settings.
Your task is to create a translation service module that initializes translators with different configurations based on environment requirements. The service should support multiple deployment scenarios (production, testing, and restricted networks) with appropriate translator settings.
Create a Python module that provides translator instances configured for three different environments:
Implement a function get_translator(environment: str) that returns an appropriately configured translator instance based on the environment parameter. The function should accept "production", "development", or "restricted" as valid environment values.
@generates
def get_translator(environment: str):
"""
Returns a configured translator instance for the specified environment.
Args:
environment: One of "production", "development", or "restricted"
Returns:
A configured Translator instance
Raises:
ValueError: If environment is not recognized
"""
passProvides translation services via Google Translate API.