Skip to main content
Help us improve Python packaging – donate today!

A simple Django app to automatically translate the pot (`.po`) files generated by django's makemessages command using google translate.

Project Description

A simple Django app to automatically translate the pot (.po) files generated by django’s makemessages command using google translate.

Installation:

pip install dj-translate

Add 'autotranslate' to your INSTALLED_APPS setting.

INSTALLED_APPS = (
    ...
    'autotranslate',
)

Quickstart:

python manage.py makemessages --no-wrap --no-location --no-obsolete

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:

  1. -f, --set-fuzzy: Set the ‘fuzzy’ flag on autotranslated entries
  2. -l, --locale 'locale': Only translate the specified locales
  3. -u, --untranslated: Only translate the untranslated messages
python manage.py translate_messages -l 'de' -l 'es'

Settings:

  1. Use a google translation - Web scrapper (Not recomm):
AUTOTRANSLATE_TRANSLATOR_SERVICE = 'autotranslate.services.GoSlateTranslatorService'
  1. Use a Google API based Translation Service:
# default: 'autotranslate.services.GoSlateTranslatorService'
# pip install google-api-python-client
AUTOTRANSLATE_TRANSLATOR_SERVICE = 'autotranslate.services.GoogleAPITranslatorService'
GOOGLE_TRANSLATE_KEY = '<google-api-key>'

Edit translation strings:

Add an URL entry to your project’s urls.py, for example:

from django.conf import settings

if 'autotranslate' in settings.INSTALLED_APPS:
    urlpatterns += [
        url(r'^autotranslate/', include('autotranslate.urls')),
    ]

Login as admin:

Nevigate to : http://127.0.0.1:8000/autotranslate

Release history Release notifications

This version
History Node

1.0.4

History Node

1.0.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
dj-translate-1.0.4.tar.gz (114.8 kB) Copy SHA256 hash SHA256 Source None Oct 6, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page