7.5. Localization

Setting up localization for Ferda webadmin tool.

Basic languages for Ferda are English and Czech.

If you want to add another language, you have to add locales both in Python and JavaScript.

7.5.1. Localizing Python

Python uses the gettext system where locales are stored in message files (.po).

Generate a message file for the new language using the command django-admin makemessages -l <language>` command from the root of the Ferda app.

Translate the strings into the target language.

You need to compile them with the command django-admin compilemessages before deployment.

7.5.2. Localizing JavaScript

JavaScript stores translations in the yaml <https://learnxinyminutes.com/docs/yaml/> format.

Ferda has locales in the directory ferda/static/ferda/locales/, which contains a subdirectory for each language.

Copy the contents of one of them (e.g. from en) to a new directory named after the target language (e.g. es).

Translate the strings into the target language.

7.5.3. Setting up a new language

After creating localizations, you need to enable them for use in Ferda.

To set up your new language (e.g. Spanish), modify the following variables in the .env file:

Localization setting example

If a translation string is missing, the localization falls back to the English string.