我需要使用 Babel 或 Babelex 为 Flask 应用程序创建翻译。
跑:
pybabel extract -F babel.cfg -o messages.pot .
...成功,创建messages.pot
.
在文件messages.pot
中有更改:
#: service/menu/Menu.py:53
msgid "A new menu has been successfully saved!"
msgstr "Nové menu bylo úspěšně uloženo!"
然后我创建一个.po
文件。
pybabel init -i messages.pot -d translations -l cs
*.po
文件内容为:
#: service/menu/Menu.py:53
msgid "A new menu has been successfully saved!"
msgstr "Nové menu bylo úspěšně uloženo!"
翻译后的文件坏了,所有文件都是 UTF-8。当我将文件编译*.po
为*.mo
文件时,它是一样的。