unbabelizer
unbabelizer is an interactive CLI and TUI (Text User Interface) tool for
managing gettext .po translation files.
It streamlines the localization workflow for Python projects by automating
extraction, translation, review, and compilation of translation files.
Read 👉 Medium Blog Article 👈 to learn more.
Purpose
The main goal of unbabelizer is to simplify and automate the process of
internationalizing Python applications.
It provides a guided interface for developers and translators to:
- Extract translatable strings from source code using
babel. - Automatically translate
.pofiles using translation services. - Review and edit translations interactively.
- Compile
.pofiles into binary.mofiles for deployment. - Manage multiple languages and domains with ease.
- Integrate seamlessly with Babel and polib for robust gettext support.
Supported translation services:
- Google Translate
- Microsoft Translator
- Yandex Translator
- ChatGPT Translation Service
- MyMemory Translator
- Deepl Translator
Demo
The app is itself available in German language. Simply run
LANG=de unbabelizer
to execute the app in German language.
Features
- Interactive TUI: Edit and review translations in a modern terminal UI powered by Textual.
- Automated Extraction: Find and extract translatable strings from your codebase using Babel.
- Batch Translation: Translate
.pofiles automatically via Google Translate, with support for multiple target languages. - Review Workflow: Step through translations, edit entries, and mark reviewed items.
- Compilation: Compile
.pofiles to.mofor production use. - Configurable: Control all aspects via
pyproject.tomlor CLI arguments. - Exclusion Patterns: Skip files or directories using glob patterns.
- Custom Mapping: Provide custom Babel mapping for source file types.
- Logging: Detailed logging for troubleshooting and auditing translation changes.
Installation
You can install the package via pip:
pip install unbabelizer
Usage
Execute in a directory with a pyproject.toml config file:
unbabelizer
The configuration section in pyproject.toml might look as follows:
[tool.unbabelizer]
# List of destination languages (e.g., German)
dest_lang = ["de"]
# Paths to search for source files
input_paths = ["src"]
# Directory for locale files
locale_dir = "src/unbabelizer/locales"
# Source language code
src_lang = "en"
# Domain for the .po files (default: "messages")
domain = "messages"
# Patterns to exclude from searching (optional)
exclude_patterns = ["tests/*", "docs/*"]
# Content of the Babel mapping file (optional)
mapping_file_content = """
[python: **.py]
encoding = utf-8
"""
# Line width for .po files (optional, default: 120)
line_width = 120
# Translation service specific settings
api_key = "<my-api-key>"
api_key_type = "<free or paid>"
model = "gpt-3.5-turbo"
http_proxy = "http://<my-proxy>"
https_proxy = "https://<my-proxy>"
You can also override these settings using CLI arguments:
unbabelizer \
--dest-lang de \
--input-paths src \
--locale-dir src/unbabelizer/locales \
--src-lang en \
--domain messages \
--exclude-patterns tests/* docs/* \
--mapping-file "~/mapping_file.txt" \
--line-width 120
--dest-lang: Destination language(s) (repeat or use multiple values)--input-paths: Source file paths (repeat or use multiple values)--locale-dir: Locale directory--src-lang: Source language code--domain: .po file domain--exclude-patterns: Patterns to exclude (optional)--mapping-file: Babel mapping file (optional)--line-width: Line width for .po files (optional)
Run unbabelizer --help to see all available options.
Settings from the CLI override those in pyproject.toml.
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the MIT License.
Metadata
Release files for unbabelizer 1.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| unbabelizer-1.3.1.tar.gz | 55.0 kB | Without provenance | Details for unbabelizer-1.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| unbabelizer-1.3.1-py3-none-any.whl | Python 3 | none | any | Details for unbabelizer-1.3.1-py3-none-any.whl |
Total release size: 122.7 kB
Release files / unbabelizer-1.3.1.tar.gz
| Download URL | unbabelizer-1.3.1.tar.gz |
|---|---|
| Size | 55.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dfade8906eb38aa98d4a4dcae050a942471255ae3a2d97b86ef94ac60901d8d6
|
|
BLAKE2b-256 checksum How to use checksums |
549224d3818e509a5c5a1253439d4997fbe2de8895293adebef4c234f1b63cbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Release files / unbabelizer-1.3.1-py3-none-any.whl
| Download URL | unbabelizer-1.3.1-py3-none-any.whl |
|---|---|
| Size | 67.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2cc96801f386b2d0726cba4dd0d03a24bb155c92afa2798e66af7e3a40e96eef
|
|
BLAKE2b-256 checksum How to use checksums |
29325db506d9fc04d29f57997b1f813f1c7f6b964b6ca9d46ae9b0310b3e437e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Security for unbabelizer 1.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.