【发布时间】:2017-02-21 18:45:41
【问题描述】:
我已经设置了 Flask + Babel + Flask Security。 像这样创建所有翻译:
- 根
- main.py
- 翻译
- 汝
- LC_MESSAGES
- messages.mo
- messages.po
- LC_MESSAGES
- 汝
在 main.py 中有部分设置语言执行:
@babel.localeselector
def get_locale():
user = getattr(g, 'user', None)
if user is not None:
print("User locale {}".format(user.locale))
return user.locale
# I put here constant to test
return 'ru'
但是http://localhost/login 没有被翻译。你能建议在哪里挖吗?即使使用 Debug = True
,日志中也没有错误【问题讨论】:
-
我发现翻译适用于 templates/ 中的模板,但不适用于 templates/security/
标签: python flask flask-security python-babel flask-babel