Skip to main content

Automate Django .po file translation with AI. Repeatable, consistent, and pennies per language.

Project description

translatebot-django

PyPI Downloads Tests Coverage License: MPL 2.0

Python Django

Automate Django translations with AI. Repeatable, consistent, and pennies per language.

Documentation: https://translatebot.dev/docs/

The Problem

Translating a Django app sounds simple until it isn't:

  • Manual workflow doesn't scale. Copy strings to Google Translate, paste back, fix placeholders, repeat for every language. It works for 20 strings. It falls apart at 200.
  • AI assistants work once, but not repeatedly. You can ask ChatGPT or Claude Code to translate a .po file, and it'll do a decent job. Once. Next sprint, when 15 new strings appear, you're prompting from scratch, re-translating the whole file, and hoping it stays consistent.
  • SaaS translation platforms are expensive overkill. Paid localization services charge per-word subscriptions and come with portals, review workflows, and team features you don't need for a solo project or small team.

Why TranslateBot

TranslateBot is a dedicated tool that sits between "do it by hand" and "pay for a platform":

  • Incremental. Only translates new and changed strings. Add 10 strings in a sprint, pay for 10 strings, not the whole file.
  • Consistent. A TRANSLATING.md file in your repo acts as a version-controlled glossary: terminology, tone, brand rules. Every translation run uses it.
  • Cost-efficient. Batches strings into optimized API requests. A typical app costs under $0.01 per language with GPT-4o-mini.
  • Scales to many languages. One command translates all your configured languages. Adding a new locale is a one-liner.
  • Automatable. A CLI command you can script or hook into your workflow. No browser, no portal.
  • Placeholder-safe. Preserves %(name)s, {0}, %s, and HTML tags with 100% test coverage on format string handling.

Installation

TranslateBot is a development tool, so we recommend installing it as a dev dependency:

uv add --dev translatebot-django

Quick Start

# settings.py
INSTALLED_APPS = [
    # ...
    'translatebot_django',
]

TRANSLATEBOT_API_KEY = "your-api-key-here"
# Translate to Dutch
python manage.py translate --target-lang nl

# Preview without saving
python manage.py translate --target-lang nl --dry-run

Features

  • Multiple AI Providers: OpenAI, Anthropic, Google Gemini, Azure, many more, and DeepL
  • Smart Translation: Preserves placeholders (%(name)s, {0}, %s) and HTML tags
  • Model Field Translation: Supports django-modeltranslation
  • Flexible Configuration: Django settings, environment variables, or CLI arguments
  • Well Tested: 100% code coverage

When to Use TranslateBot

For a one-off translation of 20 strings, ChatGPT works fine. TranslateBot is for ongoing projects with multiple languages where translations need to stay in sync as your code changes.

Use TranslateBot when:

  • You're actively developing and strings change every sprint
  • You support 3+ languages and want them all updated at once
  • You want consistent terminology across translation runs
  • You want translations done in seconds, not hours of manual work

Documentation

For full documentation, visit translatebot.dev/docs/

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

# Setup
git clone https://github.com/gettranslatebot/translatebot-django.git
cd translatebot-django
uv sync --extra dev

# Run tests
uv run pytest

License

This project is licensed under the Mozilla Public License 2.0 - see the LICENSE file for details.

Credits

  • Built with LiteLLM for universal LLM provider support
  • Uses polib for .po file manipulation

Made with ❤️ for the Django community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

translatebot_django-0.9.1.tar.gz (52.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

translatebot_django-0.9.1-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

Details for the file translatebot_django-0.9.1.tar.gz.

File metadata

  • Download URL: translatebot_django-0.9.1.tar.gz
  • Upload date:
  • Size: 52.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for translatebot_django-0.9.1.tar.gz
Algorithm Hash digest
SHA256 4b8e1ed09a5bddef6b2586248325e3841c2dd848ef4ced3755b530e2e746331a
MD5 50e8429cade17d3eac5bed8d76f1eda0
BLAKE2b-256 80ea73595bc1c7ab4cadcb77235d0d2553c34c59eaf788423dcc8ec9b12f737a

See more details on using hashes here.

Provenance

The following attestation bundles were made for translatebot_django-0.9.1.tar.gz:

Publisher: publish.yml on gettranslatebot/translatebot-django

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file translatebot_django-0.9.1-py3-none-any.whl.

File metadata

File hashes

Hashes for translatebot_django-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b5b68c9a58a5f24799dc6eaaf712bc73bfed37b411996009846567c0df8296c0
MD5 a233db3f3654d38ccee9821952725e08
BLAKE2b-256 d41fbf1a06538e9025eff4d3dd7926fbfdaed4f87e3f7bd1c7629b1ab563bb02

See more details on using hashes here.

Provenance

The following attestation bundles were made for translatebot_django-0.9.1-py3-none-any.whl:

Publisher: publish.yml on gettranslatebot/translatebot-django

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page