Internationalization and localization

Refer to the Django i18n documentation to get started with internationalization (i18n).

Enabling i18n in Django

Make sure you’ve activated translation for your project (the fastest way is to check in your file if MIDDLEWARE_CLASSES includes django.middleware.locale.LocaleMiddleware).

Then compile the messages so they can be used by Django.

python compilemessages

It should get you started !

Translating django-admin2

The translation of the language files is handled using Transifex.

Improving existing translations

To check out what languages are currently being worked on, check out the Project page. If you want to help with one of the translations, open the team page by clicking on the language and request to join the team.

Button labeled "Join team"

Now you can start translating. Open the language page, select a language resource (e.g. djadmin2.po).

Button labeled "Translate now"

Then select a string from the list on the left and enter a translation on the right side. Finally, click the Save button on the top right and you’re done.

It is also possible to suggest better translations for existing ones with the Suggest button on the bottom.

Requesting a new language

If a language is not available on Transifex yet, you can request it with the Request language button on the Project page.

Button labeled "Request language"

Using i18n in the django-admin2 project development

This section is mainly directed at

Marking strings for translation

Python code

Make sure to use gettext or gettext_lazy on strings that will be shown to the users, with string interpolation ( “%(name_of_variable)s” instead of “%s” ) where needed.

Remember that all languages do not use the same word order, so try to provide flexible strings to translate !


Make sure to load the i18n tags and put trans tags and blocktrans blocks where needed.

Block variables are very useful to keep the strings simple.

Adding a new locale

cd djadmin2 makemessages -l $LOCALE_CODE

A new file will be created under locale/$LOCALE_CODE/LC_MESSAGES/django.po

Update the headers of the newly created file to match existing files and start the translation!

If you need help to adjust the Plural-Forms configuration in the .po file, refer to the gettext docs.

Updating existing locales

To update the language files with new strings in your .py files / templates:

cd djadmin2 # or any other package, for instance example/blog makemessages -a

Then translate the files directly or upload them to Transifex.

When the translation is done, you need to recompile the new translations: compilemessages