Translators
raw JSON → 6.0.4 verified Mon Apr 27 auth: no python
A Python library for free, multiple, and enjoyable translations. Version 6.0.4 supports over 50 translation services including Google, Bing, DeepL, and Yandex. Active development with frequent updates.
pip install translators Common errors
error KeyError: 'translation' ↓
cause The translation failed due to an unsupported language pair or service unavailability.
fix
Check the translator name and language codes; use try/except to handle failures.
error ModuleNotFoundError: No module named 'translators' ↓
cause The library is not installed in the current Python environment.
fix
Run 'pip install translators' in your terminal or environment.
error TypeError: translate_text() got an unexpected keyword argument 'engine' ↓
cause Using old parameter name 'engine' which was renamed to 'translator' in v6.
fix
Replace 'engine=' with 'translator=' and 'from_lang=' with 'from_language=', 'to_lang=' with 'to_language='.
Warnings
breaking In version 6.0, the function signature changed: 'translator' parameter renamed from 'translator' (was 'engine' in v5). Also 'from_language' and 'to_language' replaced 'from_lang' and 'to_lang'. ↓
fix Update function calls to use new parameter names: translator, from_language, to_language.
gotcha Some translators (e.g., Google) may rate-limit or block requests. Use sleep delays or proxies to avoid issues. ↓
fix Add time.sleep(1) between requests or use a rotating proxy list.
gotcha Not all translators support all language pairs. Check supported languages with ts.get_languages(translator_name). ↓
fix Verify language support before translating.
deprecated The 'translators' parameter 'sleep_seconds' is deprecated in favor of setting delays manually. ↓
fix Use time.sleep() instead.
Imports
- translators wrong
from translators import *correctimport translators as ts
Quickstart
import translators as ts
# Translate text from English to Chinese
translation = ts.translate_text('Hello, world!', translator='google', from_language='en', to_language='zh')
print(translation)
# List available translators
print(ts.translators_pool())