# Python translation libraries

Python translation libraries convert text from one human language to another from Python code. A client either sends each string to a hosted translation service or runs a downloaded language model on the local machine. These libraries let apps and AI agents serve content in a reader's own language.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [google-cloud-translate](#google-cloud-translate) | 8.8M | 5.4K | Oct 2026 | Apache-2.0 |
| [Googletrans](#googletrans) | 2.2M | 4.3K | Jan 2025 | MIT |
| [deep-translator](#deep-translator) | 1.8M | 2.0K | Jun 2023 | MIT |
| [DeepL Python](#deepl-python) | 1.3M | 1.3K | Nov 2026 | MIT |
| [Argos Translate](#argos-translate) | 489.6K | 6.6K | Feb 2026 | MIT OR CC0 |
| [Translate](#translate) | 287.5K | 760 | Jul 2026 | MIT |
| [LibreTranslate-py](#libretranslatepy) | 287.1K | 131 | Apr 2024 | MIT |
| [Azure Text Translation](#azure-ai-translation-text) | 245.5K | 5.6K | May 2026 | MIT |

Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[google-cloud-translate](#google-cloud-translate) has the most monthly downloads in this comparison, at 8.8M.

## Capabilities

| Library | In-process inference | Batch input API |
| --- | --- | --- |
| [google-cloud-translate](#google-cloud-translate) | No | Yes |
| [Googletrans](#googletrans) | No | Yes |
| [deep-translator](#deep-translator) | No | Yes |
| [DeepL Python](#deepl-python) | No | Yes |
| [Argos Translate](#argos-translate) | Yes | No |
| [Translate](#translate) | No | No |
| [LibreTranslate-py](#libretranslatepy) | No | No |
| [Azure Text Translation](#azure-ai-translation-text) | No | Yes |

## Libraries

### google-cloud-translate

[GitHub](https://github.com/googleapis/google-cloud-python) · [PyPI](https://pypi.org/project/google-cloud-translate) · [Docs](https://docs.cloud.google.com/python/docs/reference/translate/latest)

Provides the client library for the Google Cloud Translate API.

- Downloads / mo: 8.8M
- Stars: 5.4K
- Last release: 3.28.0
- License: Apache-2.0
- Capabilities: [From the google-cloud-translate docs](https://docs.cloud.google.com/python/docs/reference/translate/latest)

```sh
pip install google-cloud-translate
```

**GoogleCloudPlatform/python-docs-samples** (8.2K stars)

[GoogleCloudPlatform/python-docs-samples](https://github.com/GoogleCloudPlatform/python-docs-samples) 

```python
def batch_translate_text(
    input_uri: str = "gs://YOUR_BUCKET_ID/path/to/your/file.txt",
    output_uri: str = "gs://YOUR_BUCKET_ID/path/to/save/results/",
    project_id: str = "YOUR_PROJECT_ID",
    timeout: int = 180,
) -> translate.TranslateTextResponse:
    """Translates a batch of texts on GCS and stores the result in a GCS location.

    Args:
        input_uri: The input URI of the texts to be translated.
        output_uri: The output URI of the translated texts.
        project_id: The ID of the project that owns the destination bucket.
        timeout: The timeout for this batch translation operation.

    Returns:
        The translated texts.
    """

    client = translate.TranslationServiceClient()

    location = "us-central1"
    # Supported file types: https://cloud.google.com/translate/docs/supported-formats
    gcs_source = {"input_uri": input_uri}

    input_configs_element = {
        "gcs_source": gcs_source,
        "mime_type": "text/plain",  # Can be "text/plain" or "text/html".
    }
    gcs_destination = {"output_uri_prefix": output_uri}
    output_config = {"gcs_destination": gcs_destination}
    parent = f"projects/{project_id}/locations/{location}"

    # Supported language codes: https://cloud.google.com/translate/docs/languages
    operation = client.batch_translate_text(
        request={
            "parent": parent,
            "source_language_code": "en",
            "target_language_codes": ["ja"],  # Up to 10 language codes here.
            "input_configs": [input_configs_element],
            "output_config": output_config,
        }
    )

    print("Waiting for operation to complete...")
    response = operation.result(timeout)

    print(f"Total Characters: {response.total_characters}")
    print(f"Translated Characters: {response.translated_characters}")

    return response

```

[translate/samples/snippets/translate_v3_batch_translate_text.py](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/b2be9c178a3e3bae0cdc46fe20db3b7168657059/translate/samples/snippets/translate_v3_batch_translate_text.py#L19-L68) · [More projects using google-cloud-translate →](https://dashboard.exa.ai/playground/search?q=google-cloud-translate%20GitHub%20projects)

**Quickstart**

```python
from google.cloud import translate_v3
project_id = 'YOUR_PROJECT_ID'
client = translate_v3.TranslationServiceClient()
response = client.translate_text(request={
    'parent': f'projects/{project_id}/locations/global',
    'contents': ['Hello world!'], 'mime_type': 'text/plain', 'target_language_code': 'es',
})
print(response.translations[0].translated_text)

```

From [README.md](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/b2be9c178a3e3bae0cdc46fe20db3b7168657059/translate/samples/snippets/translate_v3_translate_text.py)

### Googletrans

[GitHub](https://github.com/ssut/py-googletrans) · [PyPI](https://pypi.org/project/googletrans) · [Docs](https://py-googletrans.readthedocs.io/en/latest/)

Provides a Python client for Google Translate’s public web interface.

- Downloads / mo: 2.2M
- Stars: 4.3K
- Last release: 4.0.2
- License: MIT
- Capabilities: [From the Googletrans docs](https://py-googletrans.readthedocs.io/en/latest/)

**Strengths**

- **Detects source language automatically.** Omit the source language to let the service detect it.
- **Translates lists in one session.** Pass a list of strings to translate a batch through one HTTP session.

**Watch out for**

- **Unstable web API dependency.** Translation relies on an unofficial web API without a stability guarantee.
- **Client IPs can be blocked.** Server-side IP blocks can cause failed translation requests.

```sh
pip install googletrans
```

**PDFMathTranslate/PDFMathTranslate** (38.4K stars)

[PDFMathTranslate/PDFMathTranslate](https://github.com/PDFMathTranslate/PDFMathTranslate) 

```python
def do_translate(self, text):
    async def translate():
        async with GoogleTrans(raise_exception=True, timeout=20) as translator:
            result = await translator.translate(
                text[:5000], src=self.lang_in, dest=self.lang_out
            )
            return remove_control_characters(result.text)

    return asyncio.run(translate())

```

[pdf2zh/translator.py](https://github.com/PDFMathTranslate/PDFMathTranslate/blob/cd267ab38a939745da68aa9c3accceeca255e3ca/pdf2zh/translator.py#L176-L184) · [More projects using Googletrans →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20that%20use%20googletrans&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import asyncio
from googletrans import Translator
async def translate_text():
    async with Translator() as translator:
        result = await translator.translate('안녕하세요.', dest='en')
        print(result.text)
asyncio.run(translate_text())

```

From [README.rst](https://github.com/ssut/py-googletrans/blob/main/README.rst)

### deep-translator

[GitHub](https://github.com/nidhaloff/deep-translator) · [PyPI](https://pypi.org/project/deep-translator) · [Docs](https://deep-translator.readthedocs.io/en/stable/usage.html)

Provides translator classes and helpers for several remote translation services.

- Downloads / mo: 1.8M
- Stars: 2.0K
- Last release: 1.11.4
- License: MIT
- Capabilities: [From the deep-translator docs](https://deep-translator.readthedocs.io/en/stable/usage.html)

**Strengths**

- **Uses several translation services.** Choose translator classes behind a similar Python interface.
- **Supports text-list translation.** Call translate_batch() to translate a list of input strings.

**Watch out for**

- **File translation returns a string.** translate_file() returns translated text; writing a document is a separate step.
- **Separate detection needs credentials.** Supply an API key when calling the standalone language-detection helpers.

```sh
pip install deep-translator
```

**debpalash/VoiceStudio** (108.6K stars)

[debpalash/VoiceStudio](https://github.com/debpalash/VoiceStudio) 

```python
def main():
    # Load English base translations
    en_path = os.path.join(LOCALES_DIR, "en.json")
    with open(en_path, "r", encoding="utf-8") as f:
        en_data = json.load(f)

    en_flat = get_flat_keys(en_data)
    print(f"Loaded English base translations. Total keys: {len(en_flat)}", flush=True)

    for lang in LANGUAGES:
        if lang == "en":
            continue

        lang_path = os.path.join(LOCALES_DIR, f"{lang}.json")

        # Load existing target file or initialize
        if os.path.exists(lang_path):
            with open(lang_path, "r", encoding="utf-8") as f:
                try:
                    lang_data = json.load(f)
                except Exception:
                    lang_data = {}
        else:
            lang_data = {}

        lang_flat = get_flat_keys(lang_data)

        # Identify missing keys
        missing_keys = []
        for k in en_flat:
            if k not in lang_flat:
                missing_keys.append(k)

        print(f"\nLanguage: {lang} | Existing: {len(lang_flat)} keys | Missing: {len(missing_keys)} keys", flush=True)

        if not missing_keys:
            print(f"Language {lang} is already 100% complete!", flush=True)
            continue

        # Translate missing keys in batches of 40 using the join/split method
        batch_size = 40
        translator = GoogleTranslator(source='en', target=lang)

        for i in range(0, len(missing_keys), batch_size):
            batch_keys = missing_keys[i:i+batch_size]
            batch_values = [en_flat[k] for k in batch_keys]

            # Mask placeholders
            masked_values = []
            masks_metadata = []
            for val in batch_values:
                masked, vars_found, tags_found = mask_text(val)
                masked_values.append(masked)
                masks_metadata.append((vars_found, tags_found))

            print(f"  Translating batch {i//batch_size + 1}/{ -(-len(missing_keys)//batch_size) } ({len(batch_keys)} keys)...", flush=True)

            # Join with XXX delimiter
            joined_string = "\n\nXXX\n\n".join(masked_values)

            # Perform translation
            success = False
            try:
                translated_joined = translator.translate(joined_string)
                parts = [p.strip() for p in DELIM_SPLIT.split(translated_joined) if p.strip()]

                # Check if the split parts match the batch keys length
                if len(parts) == len(batch_keys):
                    for k, translated_val, (vars_found, tags_found) in zip(batch_keys, parts, masks_metadata):
                        final_val = unmask_text(translated_val, vars_found, tags_found)
                        set_nested_value(lang_data, k, final_val)
                    success = True
                else:
                    print(f"    Batch split length mismatch (expected {len(batch_keys)}, got {len(parts)}). Falling back to individual translation...", flush=True)
            except Exception as e:
                print(f"    Error translating batch: {e}. Falling back to individual translation...", flush=True)

            if not success:
                # Fallback to translating one-by-one for this batch
                for k, val, (vars_found, tags_found) in zip(batch_keys, batch_values, masks_metadata):
                    try:
                        masked, v_f, t_f = mask_text(val)
                        trans_val = translator.translate(masked)
                        final_val = unmask_text(trans_val, v_f, t_f)
                        set_nested_value(lang_data, k, final_val)
                        time.sleep(0.05)
                    except Exception as ie:
                        print(f"      Individual error for key {k}: {ie}", flush=True)
                        set_nested_value(lang_data, k, val) # Fallback to original English

            time.sleep(0.2) # Sleep to be polite to the translation endpoints

        # Write fully updated target file
        with open(lang_path, "w", encoding="utf-8") as f:
            json.dump(lang_data, f, ensure_ascii=False, indent=2)

        print(f"Finished {lang}.json. Saved successfully!", flush=True)

```

[scripts/translate_all.py](https://github.com/debpalash/VoiceStudio/blob/c1050c16d9b3881e5d4161ee58ccc0582b3f20f9/scripts/translate_all.py#L74-L170) · [More projects using deep-translator →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20that%20use%20deep-translator&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
from deep_translator import GoogleTranslator
translated = GoogleTranslator(source='auto', target='de').translate('Hello world!')
print(translated)

```

From [usage.html](https://pypi.org/pypi/deep-translator/json)

### DeepL Python

[GitHub](https://github.com/DeepL/deepl-python) · [PyPI](https://pypi.org/project/deepl) · [Docs](https://github.com/DeepLcom/deepl-python)

Translates text and document files through the DeepL API.

- Downloads / mo: 1.3M
- Stars: 1.3K
- Last release: 1.33.0
- License: MIT
- Capabilities: [From the DeepL Python docs](https://github.com/DeepLcom/deepl-python)

**Strengths**

- **Translates document files.** Translate files through input and output paths or file objects.
- **Applies custom terminology.** Supply glossary entries to customize translations of selected terms.

**Watch out for**

- **Translation requires API credentials.** Create an API account and supply an authentication key.

```sh
pip install deepl
```

**Quickstart**

```python
import deepl

auth_key = "f63c02c5-f056-..."  # Replace with your key
deepl_client = deepl.DeepLClient(auth_key)

result = deepl_client.translate_text("Hello, world!", target_lang="FR")
print(result.text)  # "Bonjour, le monde !"

```

From [README.md](https://github.com/DeepL/deepl-python/blob/main/README.md) · [Find projects using DeepL Python →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20that%20use%20deepl&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

### Argos Translate

[GitHub](https://github.com/argosopentech/argos-translate) · [PyPI](https://pypi.org/project/argostranslate) · [Docs](https://argos-translate.readthedocs.io/en/latest/)

Translates locally using installed language-pair model packages.

- Downloads / mo: 489.6K
- Stars: 6.6K
- Last release: 1.11.0
- License: MIT OR CC0
- Capabilities: [From the Argos Translate docs](https://argos-translate.readthedocs.io/en/latest/)

**Strengths**

- **Runs translation locally.** Run translation locally after the required models are installed.
- **Connects indirect language pairs.** Use intermediate-language models when a direct translation pair is missing.

**Watch out for**

- **Models must be installed first.** Install the requested language-pair package before translating text locally.
- **Indirect translations can lose quality.** Translating through an intermediate language can reduce output quality.
- **Document translation needs an add-on.** Install argos-translate-files to read and write translated document files.

```sh
pip install argostranslate
```

**PDFMathTranslate/PDFMathTranslate** (38.4K stars)

[PDFMathTranslate/PDFMathTranslate](https://github.com/PDFMathTranslate/PDFMathTranslate) 

```python
def __init__(self, lang_in, lang_out, model, ignore_cache=False, **kwargs):
    try:
        import argostranslate.package
        import argostranslate.translate
    except ImportError:
        logger.warning(
            "argos-translate is not installed, if you want to use argostranslate, please install it. If you don't use argostranslate translator, you can safely ignore this warning."
        )
        raise
    super().__init__(lang_in, lang_out, model, ignore_cache)
    lang_in = self.lang_map.get(lang_in.lower(), lang_in)
    lang_out = self.lang_map.get(lang_out.lower(), lang_out)
    self.lang_in = lang_in
    self.lang_out = lang_out
    argostranslate.package.update_package_index()
    available_packages = argostranslate.package.get_available_packages()
    try:
        available_package = list(
            filter(
                lambda x: x.from_code == self.lang_in
                and x.to_code == self.lang_out,
                available_packages,
            )
        )[0]
    except Exception:
        raise ValueError(
            "lang_in and lang_out pair not supported by Argos Translate."
        )
    download_path = available_package.download()
    argostranslate.package.install_from_path(download_path)

```

[pdf2zh/translator.py](https://github.com/PDFMathTranslate/PDFMathTranslate/blob/cd267ab38a939745da68aa9c3accceeca255e3ca/pdf2zh/translator.py#L884-L913) · [More projects using Argos Translate →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20that%20use%20argostranslate&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import argostranslate.package
import argostranslate.translate

from_code = "en"
to_code = "es"

# Download and install Argos Translate package
argostranslate.package.update_package_index()
available_packages = argostranslate.package.get_available_packages()
package_to_install = next(
    filter(
        lambda x: x.from_code == from_code and x.to_code == to_code, available_packages
    )
)
argostranslate.package.install_from_path(package_to_install.download())

# Translate
translatedText = argostranslate.translate.translate("Hello World", from_code, to_code)
print(translatedText)
# '¡Hola Mundo!'

```

From [README.md](https://github.com/argosopentech/argos-translate/blob/master/README.md)

### Translate

[GitHub](https://github.com/terryyin/translate-python) · [PyPI](https://pypi.org/project/translate) · [Docs](https://translate-python.readthedocs.io/)

Translates text from the command line or as a Python module, with Google Translate behind it.

- Downloads / mo: 287.5K
- Stars: 760
- Last release: 3.8.1
- License: MIT
- Capabilities: [From the Translate docs](https://translate-python.readthedocs.io/)

```sh
pip install translate
```

**Quickstart**

```python
from translate import Translator
translator = Translator(to_lang='de')
translation = translator.translate('Hello world!')
print(translation)

```

From [README.rst](https://github.com/terryyin/translate-python/blob/master/README.rst) · [Find projects using Translate →](https://dashboard.exa.ai/playground/search?q=translate%20GitHub%20projects)

### LibreTranslate-py

[GitHub](https://github.com/argosopentech/LibreTranslate-py) · [PyPI](https://pypi.org/project/libretranslatepy)

Provides Python bindings for the LibreTranslate API.

- Downloads / mo: 287.1K
- Stars: 131
- Last release: 2.1.4
- License: MIT
- Capabilities: [From the LibreTranslate-py docs](https://github.com/argosopentech/LibreTranslate-py)

```sh
pip install libretranslatepy
```

**Quickstart**

```python
from libretranslatepy import LibreTranslateAPI
client = LibreTranslateAPI('http://localhost:5000')
print(client.translate('Hello world!', 'en', 'es'))

```

From [README.md](https://github.com/argosopentech/LibreTranslate-py/blob/main/README.md) · [Find projects using LibreTranslate-py →](https://dashboard.exa.ai/playground/search?q=libretranslatepy%20GitHub%20projects)

### Azure Text Translation

[GitHub](https://github.com/Azure/azure-sdk-for-python) · [PyPI](https://pypi.org/project/azure-ai-translation-text) · [Docs](https://learn.microsoft.com/en-us/python/api/overview/azure/ai-translation-text-readme?view=azure-python)

Provides the Azure AI Translation Text client library for Python.

- Downloads / mo: 245.5K
- Stars: 5.6K
- Last release: 2.0.0
- License: MIT
- Capabilities: [From the Azure Text Translation docs](https://learn.microsoft.com/en-us/python/api/overview/azure/ai-translation-text-readme?view=azure-python)

```sh
pip install azure-ai-translation-text
```

**Quickstart**

```python
from azure.ai.translation.text import TextTranslationClient
from azure.core.credentials import AzureKeyCredential
client = TextTranslationClient(endpoint='YOUR_TRANSLATOR_ENDPOINT', credential=AzureKeyCredential('YOUR_API_KEY'), region='YOUR_REGION')
response = client.translate(body=['Hello world!'], to_language=['es'])
print(response[0].translations[0].text)

```

From [README.md](https://github.com/Azure/azure-sdk-for-python/blob/c0b5da65d76ea81af1fe1b90b3242a64fcc152cf/sdk/translation/azure-ai-translation-text/README.md) · [Find projects using Azure Text Translation →](https://dashboard.exa.ai/playground/search?q=azure-ai-translation-text%20GitHub%20projects)

## FAQ

### Which Python translation library should I use?

[DeepL Python](#deepl-python) suits apps with a DeepL API account that need document translation and glossaries. [Argos Translate](#argos-translate) suits translation that runs locally after its models are installed. [deep-translator](#deep-translator) suits code that switches between several translation services through one interface.

### What is Argos Translate?

[Argos Translate](#argos-translate) translates text locally with installed language-pair model packages. When a direct pair is missing, it translates through an intermediate language.

### Is googletrans reliable?

[Googletrans](#googletrans) relies on an unofficial web API without a stability guarantee. Server-side IP blocks can also cause failed translation requests.

### How do I use Google Translate in Python?

[google-cloud-translate](#google-cloud-translate) is the client library for the Google Cloud Translate API. [Googletrans](#googletrans) calls the public Google Translate web interface instead.

### What is deep-translator?

[deep-translator](#deep-translator) provides translator classes for several remote translation services behind a similar Python interface.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Python translation libraries Googletrans deep-translator Argos Translate DeepL local models batch text file inputs document output glossaries code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
