Auto-translate django-modeltranslation fields using DeepL, Google, or OpenAI
Project description
django-traduire
Documentation | PyPI | GitHub
Auto-translate django-modeltranslation fields using DeepL, Google Cloud Translation, or OpenAI.
Fill in content in one language, and django-traduire populates all the other language columns automatically.
Install
pip install django-traduire[deepl] # DeepL backend
pip install django-traduire[google] # Google Cloud Translation
pip install django-traduire[openai] # OpenAI / LLM backend
pip install django-traduire[all] # All backends
Quick start
# settings.py
INSTALLED_APPS = [
...
"modeltranslation",
"django_traduire",
]
LANGUAGES = [
("fr", "Francais"),
("de", "Deutsch"),
("en", "English"),
("it", "Italiano"),
]
TRADUIRE = {
"BACKEND": "django_traduire.backends.deepl.DeepLBackend",
"SOURCE_LANGUAGE": "fr",
"BACKEND_OPTIONS": {
"auth_key": "your-deepl-api-key",
},
}
Translate in Python
from django_traduire import translate_instance
article = Article.objects.get(pk=1)
# article.title_fr = "Bonjour le monde"
translate_instance(article)
# article.title_de = "Hallo Welt"
# article.title_en = "Hello world"
# article.title_it = "Ciao mondo"
Management command
# Translate all registered models
python manage.py traduire
# Translate a specific model
python manage.py traduire myapp.Article
# Overwrite existing translations
python manage.py traduire --overwrite
# Dry run
python manage.py traduire --dry-run
Admin integration
from django.contrib import admin
from modeltranslation.admin import TranslationAdmin
from django_traduire.admin import TraduireMixin
@admin.register(Article)
class ArticleAdmin(TraduireMixin, TranslationAdmin):
pass
This adds "Translate empty fields" and "Translate all fields (overwrite)" actions to the admin.
Auto-translate on save
TRADUIRE = {
...
"AUTO_TRANSLATE": True,
}
Every time a model is saved, empty translation fields are filled automatically.
Backends
| Backend | Install | Best for |
|---|---|---|
| DeepL | pip install django-traduire[deepl] |
European languages, highest quality |
| Google Cloud | pip install django-traduire[google] |
Broadest language coverage |
| OpenAI | pip install django-traduire[openai] |
Creative / contextual translations |
License
MIT - Paul Guindo / Altius Academy SNC.
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_traduire-0.1.0.tar.gz.
File metadata
- Download URL: django_traduire-0.1.0.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bde6d2dad6c1d283b6ab24c078a681a53fb92276e36b1999d76493cb3343bda4
|
|
| MD5 |
79c57982f451c965dc04ae90bc2a53c3
|
|
| BLAKE2b-256 |
0032313240f8be710dd57d65477f95011b11240af1fe6eee71590676f624c3c2
|
Provenance
The following attestation bundles were made for django_traduire-0.1.0.tar.gz:
Publisher:
publish.yml on Altius-Academy-SNC/django-traduire
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_traduire-0.1.0.tar.gz -
Subject digest:
bde6d2dad6c1d283b6ab24c078a681a53fb92276e36b1999d76493cb3343bda4 - Sigstore transparency entry: 1209558015
- Sigstore integration time:
-
Permalink:
Altius-Academy-SNC/django-traduire@6e6b0e68368c8140adf09cbf30533226a058e0be -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Altius-Academy-SNC
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6e6b0e68368c8140adf09cbf30533226a058e0be -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_traduire-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_traduire-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e1cdbdb097487bf37bdb8834952c54b0157c58fff9b893ef2694b9cc1982857
|
|
| MD5 |
280afa81853f023ecc335861787396fe
|
|
| BLAKE2b-256 |
fed132364683dde25fd43e9b41c1826cf3a80129fb26b85b7518b29694964f35
|
Provenance
The following attestation bundles were made for django_traduire-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Altius-Academy-SNC/django-traduire
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_traduire-0.1.0-py3-none-any.whl -
Subject digest:
0e1cdbdb097487bf37bdb8834952c54b0157c58fff9b893ef2694b9cc1982857 - Sigstore transparency entry: 1209558058
- Sigstore integration time:
-
Permalink:
Altius-Academy-SNC/django-traduire@6e6b0e68368c8140adf09cbf30533226a058e0be -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Altius-Academy-SNC
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6e6b0e68368c8140adf09cbf30533226a058e0be -
Trigger Event:
release
-
Statement type: