Internationalized Django app back to English

django, django-cms, internationalization, localization, python

Solution

You need to do multiple things:

- Write all strings in one language, in your case English.

You then need to mark all strings for translation:

- Add `trans` tags arounds all strings in templates (from the `i18n` template tag library), see internationalization in the documentation. This is related to gettext: a common library for handling translation. By adding `trans` tags around strings they will be included in a huge list of strings that need to be translated (see `.po` and `.mo` below).

- Add `_()` around all strings in the Python source code (from `django.utils.translation`, also see internationalization in the docs). This is also related to gettext and this includes those strings as well in the gettext language files.

You then need to create the language files and add the translations to those files:

- Create the gettext `.po` and `.mo` files which contain the translation strings. In these files you can write the translated strings. These two files are often placed in the `/locale/` directory. For each language you need to write the translated strings and put them in these files. More details on these language files can be found in the Django documentation on localization.

It's good to read Django's overview on internationalization and localization (often called i18n) as the above explanation is only the general way to do it. The exact technical details are in the documentation.

Note that the above is only for translating static strings that are part of your Python code or templates. If you want to translate URLs or Django models then you'll need to install additional libraries or use other existing Django functionality. For example, in Django 1.4 some functionality was added to translate URLs but for earlier Django versions you'll need to use a library / Django app for that.

Problem

My django app is in an European language. Now I want to revert back to English and do internationalization and localization properly. I did this in setting.py ``` LANGUAGE_CODE = 'en' LANGUAGES = [ ('en', 'English'), ] ``` But the whole application is still not showing in English. Am I missing something here? PS. The app is also using Django-CMS.

Original source