Django AI Translate
Project description
🌍 django-ai-translate
AI-powered translation for Django .po files — effortless, fast, and customizable.
django-ai-translate is a Django package that automates the translation of gettext .po files using AI. Ideal for multilingual web applications, it helps you manage and update translations with minimal manual effort.
✨ Features
- 🔁 Batch Translation with customizable batch size
- ⚡️ Async Support for fast and efficient translation
- 🧠 Powered by AI (OpenAI, Groq, etc.)
- 📁 Works with standard
.pofiles - 🛠️ CLI integration via Django management command
- 📦 Easy to install and integrate in Django projects
🚀 Installation
Using uv:
uv pip install django-ai-translate
Or with pip:
pip install django-ai-translate
🛠️ Usage
Django Management Command
python manage.py translate_po -f <path-to-file.po> -l <target-language> -bs [--batch-size 100]
Example:
python manage.py translate_po -f locale/fr/LC_MESSAGES/django.po -l en -bs 100
This command will:
- Load the
.pofile - Translate all untranslated entries using AI
- Save the translations in-place
⚙️ Django Configuration
In your Django settings.py, add the following to configure the translator:
AI_TRANSLATOR = {
'ENGINE': '', # e.g. 'groq', 'openai', 'anthropic', or 'together'. The package only support these four api for now.
'API_KEY': '', # Your API key
'MODEL': '', # e.g. 'gpt-4', 'llama-3-70b'
'PROMPT_TEXT': "You are a web application translator. Don't ouput thinking. Don't add anything else than result. Translate the following text to "
}
📁 Project Structure
django_ai_translate/
├── __init__.py
├── translator.py
├── po_handler.py
├── settings.py
├── management/
│ └── commands/
│ └── translate_po.py
tests/
pyproject.toml
🙌 Contributing
Pull requests are welcome! If you’d like to contribute:
git clone https://github.com/aimedey19/django-ai-translate.git
cd django-ai-translate
uv sync
Contributors
📄 License
MIT License © Aime & Contributors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_ai_translate-0.1.1.tar.gz.
File metadata
- Download URL: django_ai_translate-0.1.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
145e703182cacc011684b04fde35b1e55592ef2f635c6e693896e47b9f08ff73
|
|
| MD5 |
3725a21ebba69b3485d35150e06e1bfe
|
|
| BLAKE2b-256 |
634826bd88bfbf4ba3df60912d4b10358ed4f18c85db3ef14ef32e800b277003
|
File details
Details for the file django_ai_translate-0.1.1-py3-none-any.whl.
File metadata
- Download URL: django_ai_translate-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9c6dd745e4687787c6ed65d218a9918fecf735e7b2a0f52842df684a31dafb9
|
|
| MD5 |
dc6a88c3eae053a834e2f857af4454bf
|
|
| BLAKE2b-256 |
e209252bd495e6c0e23b4d612014bf54cf5977037950683677c05c60bf0ff272
|