husstanden/BABEL_USAGE.md

18 lines
684 B
Markdown
Raw Permalink Normal View History

2019-05-12 16:17:22 +02:00
# 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`