Skip to content

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

License

Notifications You must be signed in to change notification settings

philipplaeubli/django-translator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Translator

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. You have to set the migrations folder for the translator, because we have to add migrations for the set languages. (More informations on the South documentation.) Add the following to your settings file:

    SOUTH_MIGRATION_MODULES = {

    'translator': 'my_project.migrations',

    }

  3. Create a migrations python package in your project folder (where your settings.py usually is).

  4. Run python manage.py schemamigration translator --initial to create the translator models based on the languages you specified in your settings file.

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

  6. 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',
    )
    
  7. 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"))
    
  8. Visit the templates. The keys get collected lazy.

  9. Translate the keys in the admin.

Project Home

https://github.com/dreipol/django-translator

PyPi

https://pypi.python.org/pypi/django-translator

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%