Skip to main content

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

Metadata

Release files for dj-translate 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dj-translate 1.0.4
File Size Uploaded Provenance
dj-translate-1.0.4.tar.gz 114.8 kB Without provenance Details

Release files / dj-translate-1.0.4.tar.gz

Download URL dj-translate-1.0.4.tar.gz
Size 114.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1463d35eb4e5f5c1cadd1ca440052f003bc00785d0de14e0b5a410e6550828b1
BLAKE2b-256 checksum
How to use checksums
7fc1ff4dee9158a79800dfb5c0cf4fbff5b80cee5e749019f36cbe7857423916
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for dj-translate 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.4 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page