You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

django-deep-translator

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

django-deep-translator

Automatically translate the pot (`.po`) files generated by django's makemessages command built on top of python deep-translator package

1.5.1
pipPyPI
Maintainers
1

django-deep-translator

Upload Python Package

Autotranslate django .po translation files package built on top of 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 with default source language as english.

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

In your settings, list the relative path to locale folders, example:

LOCALE_PATHS = (
    'locale',
    'home/locale',
    'products/locale',
    'services/locale',
)

Using a different Translation Service:

    # default: 'django_deep_translator.services.GoogleTranslatorService'
    PO_TRANSLATOR_SERVICE = 'django_deep_translator.services.GoogleAPITranslatorService'

PO_TRANSLATOR_SERVICE accepts the following services with respective additional variables:

ServiceAdditional variablesDescription
GoogleAPITranslatorService--
MicrosoftTranslatorServiceMICROSOFT_TRANSLATE_KEYYou 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--
YandexTranslatorServiceYANDEX_TRANSLATE_KEYYou 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
PapagoTranslatorServicePAPAGO_CLIENT_ID, PAPAGO_SECRET_KEYYou 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.
DeeplTranslatorServiceDEEPL_TRANSLATE_KEYVisit https://www.deepl.com/en/docs-api/ for more information on how to generate your Deepl api key
QcriTranslatorServiceQCRI_TRANSLATE_KEYVisit https://mt.qcri.org/api/ for more information
LibreTranslatorserviceLIBRE_TRANSLATE_MIRROR_URLLibre 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 .

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts