File Formats
Babelize writes JSON locale files for JavaScript frameworks and gettext .po/.mo catalogues for Django, one per language, with keys and placeholders preserved. Strings are extracted from .js, .jsx, .ts, .tsx, .vue, .html, .py and Django template files.
Babelize uses JSON locale files for React, Next.js, Vue, React Native and static HTML projects, and gettext catalogues (.po/.mo) for Django. When it scans your repository, it extracts translatable strings from your source code and writes a locale file for every target language.
Locale Files: JSON
Each locale gets its own file, for example en.json, es.json, and fr.json. Every target file mirrors the keys of the source file, so your i18n library (such as next-intl, react-i18next, or vue-i18n) can load them side by side.
| Format | Extension | Common Use |
|---|---|---|
| JSON | .json | React, Next.js, static HTML, Vue (beta), React Native (beta) |
| gettext | .po, .mo | Django (see below) |
Nested keys group related strings:
{
"messages": {
"greeting": "Hello, {name}",
"farewell": "Goodbye"
}
}Flat keys work too:
{
"greeting": "Hello, {name}",
"farewell": "Goodbye"
}When translating, Babelize:
- Preserves keys and nesting exactly; only string values are translated
- Leaves numeric and boolean values untouched
- Keeps placeholders such as
{name}intact (see Placeholder Protection)
Locale Files: gettext (Django)
Django projects use gettext catalogues instead of JSON: <LOCALE_PATHS[0]>/<lang>/LC_MESSAGES/django.po (by default locale/ next to manage.py).
- Strings come from Python files (
.py: existinggettextcalls plus hardcoded UI strings in models, forms, admin and views) and Django templates ({% trans %}/{% blocktrans %}, with hardcoded text wrapped in{% translate %}) - Existing
.potranslations are kept, never re-translated;fuzzyentries are left for you to review .mofiles are recompiled when they are tracked in the repositoryLANGUAGESandLOCALE_PATHSinsettings.pyare updated
See Django for details and current limitations.
Not Supported
Other locale formats, such as YAML, XLIFF, ARB, Markdown content, or iOS/Android string files, are not supported yet.
Source Files Scanned
Babelize extracts hardcoded strings from these source file types:
| Extension | Framework |
|---|---|
.js, .jsx, .ts, .tsx | React and Next.js (including Gatsby, Remix, and Astro projects detected as React) |
.vue | Vue single-file components and Nuxt (beta) |
.html | Static HTML/CSS/JS sites |
.py, Django templates (.html under templates/) | Django |
Placeholder Protection
Babelize automatically detects and protects common placeholder patterns:
| Pattern | Example | Handling |
|---|---|---|
| Named and positional variables | {name}, {0}, {price, number} | Protected |
| i18next / Handlebars / Mustache | {{count}}, {{- html}}, $t(key) | Protected |
| Printf-style | %s, %d, %1$s, %(name)s, %(price).2f, %%, %@ | Protected |
Python str.format | {}, {name} | Protected |
| HTML entities | —, , ’ | Protected |
| Template literals | ${variable} | Protected |
| Tags | <0>text</0>, <b>, <Link href="…"> | Tag markers protected; the text between them is translated |
| URLs, emails, inline code | https://…, help@…, `npm i` | Protected |
| ICU MessageFormat | {count, plural, one {…} other {…}} | Translated with an LLM provider and rebuilt with the target language's plural categories (e.g. Polish one/few/many/other, Japanese other only); the result must parse and keep the same arguments and select branches |
Protected spans must come back exactly once. If a translation drops, repeats or invents one — or returns an invalid ICU message, mismatched tags, or the untranslated sentence — Babelize asks the model once more with a note about what was wrong. If it still fails, the string is not written to the locale file and is reported with the reason, so your app shows the source text instead of a broken translation, and the next run retries it.
Never-translate glossary terms are protected the same way, and "always translate as" terms are sent to the model as required terminology.
Encoding
All files must be UTF-8 encoded. Other encodings are converted automatically with a warning.
Further Reading
Last updated: 2026-10-16
Bring Your Own Key (BYOK)
Bring your own key (BYOK): run Babelize translations on your own OpenAI, Anthropic, Gemini, Groq, or OpenRouter account, with fallback and warnings.
Versioning & Revisions
Every Babelize run creates an immutable revision with a source snapshot, output files, languages and credits used. View run history and get deterministic output.