Automatically translate the pot (`.po`) files generated by django's makemessages command built on top of python deep-translator package
Project description
django-deep-translator
Autotranslate django .po translation files package built on top of deep-translator https://pypi.org/project/deep-translator/
Installation
pip install django-deep-translator
Add 'django_deep_translator'
to your INSTALLED_APPS
setting:
INSTALLED_APPS = (
...
'django_deep_translator',
)
Quickstart
python manage.py translate_messages
The command finds all the generated pot (.po) files under the locale paths (LOCALE_PATHS) specified in django project settings, and translates them automatically.
Options
-f, --set-fuzzy
: Set the 'fuzzy' flag on autotranslated entries-l, --locale 'locale'
: Only translate the specified locales-u, --untranslated
: Only translate the untranslated messages-s, --source-language
: Override the default source language (en) used for translation
python manage.py translate_messages -l 'de' -l 'es'
Settings
Using a different Translation Service:
# default: 'django_deep_translator.services.GoogleTranslatorService'
PO_TRANSLATOR_SERVICE = 'django_deep_translator.services.GoogleAPITranslatorService'
GOOGLE_TRANSLATE_KEY = '<google-api-key>'
PO_TRANSLATOR_SERVICE
accepts the following services with respective additional variables:
Service | Additional variables | Description |
---|---|---|
GoogleAPITranslatorService | - | - |
MicrosoftTranslatorService | MICROSOFT_TRANSLATE_KEY |
You need to require an api key if you want to use the microsoft translator. Visit the official website for more information about how to get one. Microsoft offers a free tier 0 subscription (2 million characters per month). |
PonsTranslatorService | - | - |
MyMemoryTranslatorService | - | - |
YandexTranslatorService | YANDEX_TRANSLATE_KEY |
You need to require a private api key if you want to use the yandex translator. Visit the official website for more information about how to get one |
PapagoTranslatorService | PAPAGO_CLIENT_ID , PAPAGO_SECRET_KEY |
You need to require a client id if you want to use the papago translator. Visit the official website for more information about how to get one. |
DeeplTranslatorService | DEEPL_TRANSLATE_KEY |
Visit https://www.deepl.com/en/docs-api/ for more information on how to generate your Deepl api key |
QcriTranslatorService | QCRI_TRANSLATE_KEY |
Visit https://mt.qcri.org/api/ for more information |
LibreTranslatorservice | LIBRE_TRANSLATE_MIRROR_URL |
Libre translate has multiple mirrors which can be used for the API endpoint. Some require an API key to be used. By default the base url is set to libretranslate.de . |
Project details
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
Close
Hashes for django-deep-translator-1.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6282ff7edbf69ba306651a1c321f135878b28110ac7b0accb30bbb1337309e8d |
|
MD5 | a969d95beed2079e0589cdf89f1a81cd |
|
BLAKE2b-256 | 34d92a9522fd87030cc9b366042608b89e7f34dee1d1a2c6191b03547969d7b6 |
Close
Hashes for django_deep_translator-1.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80f62f968061012812a031735a2ab58168abfe6bc2af85b2ca51a13dff1443c9 |
|
MD5 | 04872b1b6566eafe62196590f958cd72 |
|
BLAKE2b-256 | dcd8b916fd4c19c17cf2287f09a98863f816569db5218971b27dec8b4f28bb99 |