Skip to main content

Translator is an app for collecting translations for specified keys in django admin.

Project description

Translator is an app for collecting translations for specified keys in django admin.

Quick start

  1. Add “translator, taggit, modeltranslation” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = (
        ...
        'taggit',
        'modeltranslation',
                'translator',
    )
  2. Run python manage.py schemamigration translator --auto to create the translator models based on the languages you specified in your settings file.

  3. Run python manage.py migrate to migrate the translator models to your database.

  4. If you intend to use it in the templates, add ‘translator.context_processors.translator’ to TEMPLATE_CONTEXT_PROCESSORS

    TEMPLATE_CONTEXT_PROCESSORS = (
           ...
       'translator.context_processors.translator',
    )
  5. Create translation keys in your templates and models.

    Examples:

    Template:

    {{ translator.a_key }}

    models.py:

    from translator.util import translator_lazy as _
    ...
    
    class Product(models.Model):
        name = models.TextField(verbose_name=_(u"a_key"))
  6. Visit the templates. The keys get collected lazy.

  7. Translate the keys in the admin.

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

django-translator-1.0.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file django-translator-1.0.tar.gz.

File metadata

File hashes

Hashes for django-translator-1.0.tar.gz
Algorithm Hash digest
SHA256 a8256799b6fd6a4bf3c8e98a97c930df2a95725f52e293248d08e4a5b3988a15
MD5 7aef8f374c8e8bb44a9542651a3148ae
BLAKE2b-256 d8ad0ef41ee712f07a766e0d346b74edd1077d4af5953f0322e2941ebfb2e405

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page