china: 1 items found.

flask-babel 的中文翻译存放目录

有的文章里会讲中文翻译存放目录为 zh,实际上中文也分为简体和繁体,简体又分为大陆、香港、澳门,新加波。
具体可以通过 pybabel --list-locales 查到。如

b'zh              Chinese'
b'zh_Hans         Chinese (Simplified)'
b'zh_Hans_CN      Chinese (Simplified, China)'
b'zh_Hans_HK      Chinese (Simplified, Hong Kong SAR China)'
b'zh_Hans_MO      Chinese (Simplified, Macao SAR China)'
b'zh_Hans_SG      Chinese (Simplified, Singapore)'
b'zh_Hant         Chinese (Traditional)'
b'zh_Hant_HK      Chinese (Traditional, Hong Kong SAR China)'
b'zh_Hant_MO      Chinese (Traditional, Macao SAR China)'
b'zh_Hant_TW      Chinese (Traditional, Taiwan)'

所以在生成翻译 目录时,尽量使用具体的目录。如需要简体中文可以是

pybabel init -i messages.pot -d translations -l zh_Hans_CN
More ~