translate (Unofficial API Client)

3.8.0 · active · verified Wed Apr 15

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.

Warnings

Install

Imports

Quickstart

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.")

view raw JSON →