-
Notifications
You must be signed in to change notification settings - Fork 129
Localization support
非法操作 edited this page Sep 2, 2022
·
1 revision
First, in the translation directory, check the babel.cfg
.
cd translations
If you want to add a new language support, like zh-CN
:
# create a new lang file
pybabel init -i messages.pot -d . -l zh_CN
# modify the zh_CN/messages.po file to your own language
# compile the translations
pybabel compile -d .
If you modify the source code, and need to update the exist translations:
# update the messages.pot
pybabel extract -F babel.cfg -k lazy_gettext -o messages.pot ../
# update the translations
pybabel update -i messages.pot -d . -l zh_CN
# then translate it and compile it
You can visit the http://127.0.0.1:5000/?lang=bg
to change the frontend language.
Visit flask_babel to see more config and details.