Registry / llm-agents / translate

translate

JSON →
library3.8.0pypypi✓ verified 86d ago

The `translate` library (by terryyin) is a simple command-line and Python module translator. It aims to provide translations using services like Google Translate, but operates as an unofficial client. The current version, 3.8.0, was last released on November 2, 2025, and maintains an active, albeit infrequent, release schedule.

pip install translate
INSTALL
IMPORT
SIG · TRANSLATE
T
translate
llm-agentspythonv3.8.0
Install
2.7s avg
Import
661ms
Disk
32MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.8.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.696s · 34.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.7s · import 0.626s · 35MB
32MB installed
● package 32MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Translator
from translate import Translator

The quickstart demonstrates basic text translation using the `Translator` class. It initializes a translator for a target language (e.g., French) and attempts to translate a given string. Users should be aware of the default provider and potential rate limits, as detailed in the warnings section.

from translate import Translator # Initialize translator, specifying the target language # The default provider is MyMemory, which has free usage limits. # For other providers like Google, Microsoft, or DeepL, specify them # along with a 'secret_access_key' if required (see warnings). translator = Translator(to_lang="fr") text_to_translate = "Hello, world!" try: translation = translator.translate(text_to_translate) print(f"Original: {text_to_translate}") print(f"Translated (French): {translation}") except Exception as e: print(f"An error occurred during translation: {e}") print("Note: The default provider (MyMemory) has free usage limits. You might have exceeded them.")
translate --version
Debug
Known issues
breakingThis library is an *unofficial* client for web translation services (including Google Translate's web interface). It does not use an official API key and is therefore susceptible to breaking changes if the underlying web services modify their structure or anti-bot measures. Stability is not guaranteed.
fix
For production-grade or highly stable translation, consider using official, paid APIs like Google Cloud Translation API (via `google-cloud-translate` library) or other commercial translation services.
affects: All versions
gotchaThe default translation provider for the `translate` library (as of v3.3.0 and onwards) is MyMemory, which imposes free usage limits (e.g., 1000 words/day). Exceeding this limit will result in errors. While the library can be configured to use other providers (e.g., Google, Microsoft, DeepL), these may require explicit configuration and potentially a `secret_access_key`.
fix
Monitor your usage to stay within free limits or configure a different provider. To use another provider, initialize the Translator with `Translator(provider='<provider_name>', to_lang='...', secret_access_key='<your_key>')`. Check provider-specific documentation for key requirements and usage.
affects: 3.3.0+
gotchaFrequent or high-volume requests, especially when using providers that wrap public web interfaces, can lead to aggressive rate limiting, temporary IP bans (resulting in HTTP 5xx errors), or CAPTCHA challenges.
fix
Implement delays between translation requests, use caching for frequently translated phrases, and incorporate robust error handling with retry mechanisms. Consider official APIs for high-volume needs.
affects: All versions
gotchaTranslations obtained through unofficial web-scraping methods, as used by this library, may lack the accuracy, nuance, and context-awareness provided by official, paid APIs. This can lead to less reliable or contextually incorrect results, particularly for complex, technical, or sensitive texts.
fix
For critical applications, manually review translated content. If higher accuracy and contextual understanding are paramount, invest in official translation APIs that offer features like glossaries, custom models, and better context handling.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'translate'
The 'translate' package is not installed in your Python environment.
fix
pip install translate
AttributeError: module 'translate' has no attribute 'Translator'
You attempted to access the Translator class using 'translate.Translator()' after 'import translate', but the class needs to be imported directly.
fix
from translate import Translator
translator = Translator(to_lang="zh")
HTTP Error 403: Forbidden
The unofficial Google Translate client is often blocked by Google due to rate limiting, suspected automated usage, or changes in its underlying API/scraping mechanism.
fix
Try again later, or configure a proxy for your requests using the `proxies` parameter, e.g., `Translator(to_lang="en", proxies={'https': 'http://your.proxy.com:8080'})`.
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The translation service returned an unexpected non-JSON response (e.g., an HTML error page or captcha) instead of the expected JSON data, typically due to being blocked or rate-limited by Google.
fix
This error is often a symptom of an underlying HTTP block; try using a proxy, waiting before retrying the translation, or ensuring your network connection isn't interfering.
Upgrade
Version history
3.8.0latest on PyPI · released Nov 3, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
40 hits · last 30 days
node
36
Amazon
1
OpenAI (training)
1
Resources
translate — pip install translate · libregistry