Skip to content

How to add\update languages

Nico Sandoval edited this page Nov 28, 2020 · 1 revision

Steps to generate locale files

First, re-generate the pot file:

pybabel -v extract -F locale/babel.config -o locale/core.pot src/web

Then, for every language, do (in the example, I'm doing it for 'es'):

0. First time for the language, go to step 1; else go to step 2

1.  Just copy the .pot file, make a dir you'll need, and then go to step 3

    cd locale
    cp core.pot es.po
    mkdir es/LC_MESSAGES/

2. Merge new strings with previous file

    cd locale
    msgmerge es.po core.pot > /tmp/temp_po
    mv /tmp/temp_po es.po

3. Get your favourite text editor and fill translations

    vim es.po

4. Compile the just filled .po to the correct lang place; again, as an
   example for 'es':

    msgfmt es.po --output-file=es/LC_MESSAGES/core.mo

Alternative method

Use the utilities/localize.py script that uses the Babel python package. E.g. for adding/updating translations for spanish language:

0. Run `python localize.py es` to add/update messages
1. Fill missing translations in `es.po` file
2. Run `python localize.py es` again (if `es.po` changed)
Clone this wiki locally