Back to blog

A Modern Guide to Working With Translations in Django

2026-03-28 13 min read
A Modern Guide to Working With Translations in Django

Let's be honest, managing translations in a Django app often feels like a necessary evil. For years, the choice has been between tedious manual labor or expensive, over-engineered SaaS platforms.

It doesn't have to be that way. A modern workflow treats translations just like any other part of your codebase: version-controlled, automated, and right inside your terminal. This approach saves an incredible amount of time and money.

The Problem With Old Django Translation Workflows

If you're building a multilingual Django app, you know the pain. The default process is clunky, especially for small teams and solo developers. You run makemessages, open the fresh .po file, and the real grind begins.

You find yourself in a copy-paste loop of dozens, if not hundreds, of msgid strings into a service like Google Translate or DeepL. It's slow and error-prone. Even worse, you have to manually fix all the broken f-string placeholders or Django template variables like %(name)s that the translation service mangled.

A hand-drawn diagram illustrating the complex and error-prone process of web translation, with issues like slow processing and broken placeholders, leading to errors in a web browser.

The Overkill of SaaS Platforms

Eventually, you get fed up and look at SaaS platforms like Lokalise, Crowdin, or Transifex. They promise a web UI to manage your strings, but this just swaps one set of problems for another.

For most developers, these tools feel like using a sledgehammer to crack a nut. They're built for large corporations with dedicated localization teams, not for an indie hacker trying to ship a new feature. This manual approach just doesn't scale as your app grows.

The global translation services industry is projected to grow from USD 78.8 billion in 2025 to USD 114.1 billion by 2034. This shows that localization is a core business need. As demand for multilingual apps grows, sticking with manual workflows becomes a serious bottleneck. You can read more about the trends reshaping the translation industry, but the takeaway is clear: developer-focused, automated tools are becoming a necessity.

A Better Translation Workflow for Django Developers

What if translations were just another part of your code? You'd run makemessages, follow it with a single command to get AI-powered translations, and then review the changes as a standard Git diff in a pull request. This is the idea behind a modern, developer-first approach to working with translations.

Diagram showing a developer-first translation workflow, from bot execution on a laptop to PR review.

This workflow is built around a CLI tool, TranslateBot, designed to fit into your existing habits. The goal is to stop treating internationalization as a separate, painful task. Instead, it becomes a predictable, low-friction part of your development cycle. You stay in your terminal, use tools you already know like Git, and keep your momentum.

The core idea is simple: treat your .po files like any other source code. They should be version-controlled, automatically updated, and reviewed by developers as part of the normal pull request process.

This approach gives you the speed of automation while keeping the full control of a code-first workflow. It’s a huge step up from both the tedious manual process and expensive SaaS platforms.

How The Workflows Compare

To see why a CLI-based workflow is effective, it helps to put it side-by-side with the alternatives. The old manual method is free, but it's painfully slow and a magnet for errors. SaaS platforms like Lokalise or Crowdin automate the work but introduce high subscription costs and force you out of your coding environment.

Here’s a direct comparison of the three main approaches for handling translations in a Django project.

Translation Workflow Comparison

Let's break down how the options stack up in cost, speed, and developer experience.

Aspect Manual (.po editing) SaaS Platform (Lokalise/Crowdin) CLI Tool (TranslateBot)
Cost Free (your time) High. Starts at ~$100/mo, plus per-seat pricing. Low. Pay-as-you-go for AI tokens, pennies per run.
Speed Very Slow. Manual copy-pasting for every new string. Fast. Automated string detection and translation. Very Fast. A single command in your terminal.
Workflow Broken. Constant context switching, error-prone. External. Pulls you out of your editor into a web UI. Integrated. Lives in your terminal and Git workflow.
Control Full control, but fully manual. Vendor Lock-in. Your data and process live on their platform. Full Control. You own your data and process.

As you can see, the CLI model offers a compelling balance of speed, cost, and developer-friendliness.

The CLI Advantage for Developers

For most solo developers and small teams, the CLI model is a clear winner because it's built for how we already work. After you run makemessages, you just run one more command: translate-bot translate.

Behind the scenes, the tool takes care of the tedious parts:

The result is a clean diff in your locale/ directory, ready to be committed and reviewed like any other code change. This makes internationalization a simple, repeatable step in your development process. It’s faster, cheaper, and keeps you focused on writing code.

Let's get this set up. The goal is to replace your manual .po file grunt work with an automated pipeline that runs from your terminal. You can have this workflow running in less than 10 minutes.

First, install TranslateBot. It's a standard Python package, so you can add it with pip, Poetry, or uv.

pip install django-translate-bot

This command adds translate-bot to your environment. It's a lightweight tool with no heavy dependencies, so it drops cleanly into any requirements.txt file.

Configuring Your Project

Now, tell TranslateBot two things: your target languages and how to authenticate with your translation provider. The configuration lives in your pyproject.toml file.

If you don't have one, create a pyproject.toml file in your project's root. Then, add a [tool.translate_bot] section. The only required setting is the list of target languages.

Here’s an example for translating to French and German:

# pyproject.toml

[tool.translate_bot]
# List of language codes for translation
target_languages = ["fr", "de"]

# Optional: Specify a custom path to your locale directory
# locale_path = "my_app/locale"

# Optional: Set the source language if it's not 'en'
# source_language = "en-us"

For the API key, TranslateBot reads it from an environment variable (like OPENAI_API_KEY or DEEPL_API_KEY). This keeps your secrets out of version control.

For a complete setup guide, check out how to automate your Django i18n .po file translation.

Running Your First Translation

With configuration in place, you're ready to run the command. First, make sure you've run makemessages to capture any new strings.

python manage.py makemessages

Now, run the translation command:

translate-bot translate

That single command:

The most valuable part is that TranslateBot ignores already translated strings. This keeps your API usage and costs as low as possible.

Once the command finishes, you can see the results in your locale/ directory. Review the work with a simple git diff. From there, you commit the changes and open a pull request. Your translation work is now a clean, repeatable part of your development cycle.

Improving Translation Quality With a Glossary

AI translation is fast, but it's not smart. It has no idea that your app’s “commit” button refers to a financial transaction, not a Git command. This lack of context is how you end up with inconsistent translations that confuse users. This is a classic problem when working with translations at scale.

The solution is a project-specific glossary. With TranslateBot, you create a TRANSLATING.md file in your project's root. This Markdown file acts as a brain for the AI, giving it essential context before it translates.

Creating Your Glossary File

Your TRANSLATING.md file is where you define how to handle specific terminology. You can list brand names that should not be translated, explain technical jargon, and provide preferred translations for ambiguous words.

It’s a simple Markdown file that might look like this:

# Translation Instructions for [Your Project Name]

## Glossary

-   **"TranslateBot"**: This is our brand name. Never translate it.
-   **"Commit"**: In our app, this refers to saving a record. For Spanish, use "Guardar", not "Comprometer".
-   **"Pull Request"**: For German, use the English term "Pull Request". Do not translate it.

## Tone and Style

-   Use an informal and friendly tone for all translations.

When you run translate-bot translate, the tool reads this file and includes its content as a system prompt for the AI model. This small step makes a huge difference in the quality and consistency of your translations.

AI translation can reach up to 95% accuracy for major languages, but the industry trend is toward "human-in-the-loop" models. This hybrid approach uses automation for speed and human experts for quality. A glossary is your first step toward creating a reviewable, version-controlled process. You can explore more about translation industry trends and insights on chatscontrol.com.

Handling Placeholders Automatically

One of the biggest headaches with manual translation is dealing with Django's template variables and f-string placeholders. Mistyping %(name)s or {user_id} can lead to ValueError exceptions and broken pages in production.

TranslateBot removes this risk. It automatically detects and preserves all common placeholder formats:

This means you get accurate translations without worrying about mangled placeholders. The tool protects these variables, ensuring your translated strings work correctly at runtime without manual fixes.

The infographic below shows the simple three-step flow for getting your automated setup running.

A flowchart illustrating the automated translation setup process with three steps: Install, Configure, and Translate.

This process visualizes how you move from installation to a fully translated project with a few commands. Once configured, the "Translate" step becomes a repeatable, low-effort task. For a more detailed look at what makes a translation good, check out our guide on what determines the quality of translation.

A command-line tool is great for local development, but the real power comes from automating it.

By wiring translation updates directly into your CI/CD pipeline, you make localization a predictable part of your development process. It's no longer a chore. Instead, every pull request with new text automatically gets its translations.

The video above shows what this looks like. Translations become just another check in the code review process, eliminating "translation lag" and turning internationalization into a core development habit.

A GitHub Actions Workflow Example

You can get this running in minutes using GitHub Actions. The goal is to build a workflow that triggers on every push to a feature branch. It will generate message files, translate them, and commit the updated .po files back to the branch.

Save this as .github/workflows/translate.yml in your project root.

name: "Translate New Strings"

on:
  push:
    branches-ignore:
      - main  # Don't run on the main branch

jobs:
  translate:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          # We need a token to push changes back
          token: ${{ secrets.PAT }}

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.11"

      - name: Install dependencies
        run: |
          pip install django-translate-bot
          # Add your other project dependencies here
          pip install -r requirements.txt

      - name: Run makemessages
        run: python manage.py makemessages

      - name: Run TranslateBot
        run: translate-bot translate
        env:
          DEEPL_API_KEY: ${{ secrets.DEEPL_API_KEY }}

      - name: Commit and push changes
        run: |
          git config --global user.name "github-actions[bot]"
          git config --global user.email "github-actions[bot]@users.noreply.github.com"
          git add locale/
          # Check if there are changes to commit
          if ! git diff --staged --quiet; then
            git commit -m "chore(i18n): update translations"
            git push
          else
            echo "No new translations to commit."
          fi

This workflow checks out your code, runs makemessages, and then calls translate-bot translate. If any .po files were changed, a bot commits them to the pull request branch. Your team can then review the generated translations like any other code change.

The Power of CI/CD for Translations

Automating this process enforces consistency and removes the mental overhead of remembering to run commands manually.

When you open a pull request, the status of your automated checks shows up in the GitHub UI.

The check from our workflow will appear in this list, giving you confidence that every PR is translation-ready before it gets merged.

This isn't just a neat trick. The language translation software market is projected to grow from USD 68.04 billion in 2025 to USD 116.55 billion by 2035, a jump driven by AI adoption. For developer teams, real-time, automated translation in CI/CD is quickly becoming standard practice. You can read the full research about the translation software market on precedenceresearch.com.

For a complete walkthrough, check out our guide on CI/CD integration for Django translations: https://translatebot.dev/docs/usage/ci/

Common Questions About Automated Translation

Whenever I talk to developers about moving to an automated workflow, a few questions always come up. They're usually about cost, how a tool handles Django’s features, and when you still need a human.

How Much Does This Cost Compared to a SaaS?

The cost model is completely different. A SaaS platform like Lokalise or Crowdin is a subscription. You’re paying a per-seat license and a minimum monthly fee that can hit $100 or more, even for a tiny team. You pay that whether you translate five new strings or five thousand.

A CLI tool like TranslateBot operates on a pay-as-you-go model. You only pay for the tokens you use from an AI model like OpenAI or DeepL. Since the tool only translates new strings, the cost per run is often just pennies. A small or medium-sized project can see a monthly bill under $5, not a fixed subscription.

For indie developers and small teams, this is a big deal. You aren't saddled with fixed overhead. You pay only for the actual work of working with translations as your project grows.

How Does This Handle Django Pluralization?

It just works, because it's designed for Django. When you use a {% blocktrans %} tag with a count variable, makemessages creates msgid for the singular form and msgid_plural for the plural.

TranslateBot sees that msgid/msgid_plural pair and knows what to do. It requests translations for both forms from the AI, then writes the results to msgstr[0] and msgstr[1] based on the target language's pluralization rules.

You don't have to think about it. You write your Django template code like always, run the command, and your plural forms come out correct.

When Should I Still Use a Human Translator?

An automated workflow is great for handling 95% of your app's text: buttons, labels, alerts, and day-to-day UI copy. It gives you good-enough translations instantly so you can ship features without waiting.

But AI is not a complete replacement for a human expert. You should hire a professional for:

Think of it as a hybrid approach. Automate the vast majority of UI text in your CI/CD pipeline to maintain velocity. Save your budget for a human expert to review the 5% of content that defines your brand.


Ready to stop wasting time on manual .po file editing? TranslateBot integrates AI translation directly into your terminal and CI/CD pipeline, making internationalization a simple, automated part of your Django workflow. Get started for free at https://translatebot.dev.

Stop editing .po files manually

TranslateBot automates Django translations with AI. One command, all your languages, pennies per translation.