husstanden/BABEL_USAGE.md
2019-05-12 15:17:22 +01:00

684 B

Babel usage

Babel will scan and detect sections of code that uses gettext or _ in HTML templates and python code. It takes the constant string passed into its function and makes a translation template which can then be used to build individual translations.

Usage

If you are compiling and building a template from scratch

$ pybabel extract -F babel.cfg -o messages.pot ./
$ pybabel update -i messages.pot -d translations

Make translations in the outputted file then compile the translation with

$ pybabel compile -d translations

Make sure the messages.po file is in the right language directory.
Example path: translations/nb/LC_MESSAGES/messages.po