🧩 jinja-i18n-tools
Automated i18n tool for Jinja2-based projects using Babel and Google Translate.
📦 Features
- 🔍 Extract translatable strings from your Jinja2 templates.
- 🌐 Initialize
.pofiles for multiple languages. - 🤖 Auto-translate using Google Translate via
deep_translator. - 🛠️ Compile
.pofiles into.mo. - 🧹 Automatically cleans up temporary files like
messages.potandbabel.cfg.
⚙️ Installation
pip install jinja-i18n-tools
🚀 Usage
Activate your virtual environment, then run:
jinja-i18n full
This will:
- Copy
babel.cfgto your project root. - Extract translatable strings from your templates.
- Initialize translation files for each language.
- Auto-translate all strings.
- Compile
.pofiles into.mo. - Clean up temporary files.
🛠️ CLI Commands
jinja-i18n extract
jinja-i18n init
jinja-i18n translate --lang ar
jinja-i18n translate-all
jinja-i18n compile
jinja-i18n full --lang all --force
🌍 Languages
By default, the following languages are supported:
ar– Arabicde– German
You can customize this in the source by editing the LANGUAGES list.
📁 Project Structure
Your Jinja2 templates and Python files must be located where your babel.cfg expects them. Here's a recommended configuration:
[python: **.py]
[jinja2: templates/**.html]
[jinja2: templates/**.j2]
extensions=jinja2.ext.i18n
This configuration instructs pybabel to:
- Extract translation strings from all Python files recursively.
- Extract translatable content from all
.htmltemplates under thetemplates/folder. - Enable the
jinja2.ext.i18nextension to support{% trans %}blocks.
Make sure this file (babel.cfg) is located in your project root temporarily, or is copied automatically by the tool before running pybabel extract.
🧼 Cleanup
Temporary files like babel.cfg and messages.pot are deleted automatically after the process finishes.
📜 License
This project is licensed under the MIT License.
You are free to use, modify, and distribute it with attribution.
Feel free to explore and build upon it!
👨💻 About the Author
🎯 Tamer OnLine – Developer & Architect
A dedicated software engineer and educator with a focus on building multilingual, modular, and open-source applications using Python, Flask, and PostgreSQL.
🔹 Founder of Flask University – an initiative to create real-world, open-source Flask projects
🔹 Creator of @TamerOnPi – a YouTube channel sharing tech, tutorials, and Pi Network insights
🔹 Passionate about helping developers learn by building, one milestone at a time
Connect or contribute:
💡 Got feedback or want to collaborate?
Open an issue, fork the repo, or just say hi on LinkedIn!
Metadata
Release files for jinja-i18n-tools 0.1.2
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 | |
|---|---|---|---|---|
| jinja_i18n_tools-0.1.2.tar.gz | 12.3 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jinja_i18n_tools-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.3 MB
Release files / jinja_i18n_tools-0.1.2.tar.gz
| Download URL | jinja_i18n_tools-0.1.2.tar.gz |
|---|---|
| Size | 12.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c3b35cbf9742f962e7422041a4bdfd987bda2601150549b41cbfad9adf92494f
|
|
BLAKE2b-256 checksum How to use checksums |
36263c84e338265f9f0f36ae5c01b9a9ed87a043e6564147e8537b433b720985
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Release files / jinja_i18n_tools-0.1.2-py3-none-any.whl
| Download URL | jinja_i18n_tools-0.1.2-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78cccec5d4bb77dcbbd66d45e38d5f7d656d44ea98adaa8ce1f70237aec8d321
|
|
BLAKE2b-256 checksum How to use checksums |
8e9300614f5865297694d4458bc7a4e5052b6855e1f19fefe089c3e8c9b21302
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Security for jinja-i18n-tools 0.1.2
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.