-
-
Notifications
You must be signed in to change notification settings - Fork 1
Translations
Juan Gallostra edited this page May 20, 2020
·
1 revision
Documentation: https://pythonhosted.org/Flask-Babel/
- Open
config.py
and add the desired language locale to theLANGUAGES
list. - Create the language catalog:
$ pybabel init -i messages.pot -d translations -l [LOCALE]
, where[LOCALE]
should be replaced by the new locale.
To extract all the texts that are to be translated to the .pot
file use the following command:
$ pybabel extract -F babel.cfg -k _l -o messages.pot .
To update all catalogs with the latest set of messages:
$ pybabel update -i messages.pot -d translations
After all translations have been added or updated in the respective .po
files (found under translations/[LOCALE]/LC_MESSAGES/messages.po
), to make the changes effective the translations have to be recompiled. This is achieved with the following command: $ pybabel compile -d translations