i18n.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:flask 作者: bobohope 项目源码 文件源码
def _get_translations():
    """Returns the correct gettext translations.
    Copy from flask-babel with some modifications.
    """
    ctx = _request_ctx_stack.top
    if ctx is None:
        return None
    # babel should be in extensions for get_locale
    if 'babel' not in ctx.app.extensions:
        return None
    translations = getattr(ctx, 'wtforms_translations', None)
    if translations is None:
        dirname = messages_path()
        translations = support.Translations.load(
            dirname, [get_locale()], domain='wtforms'
        )
        ctx.wtforms_translations = translations
    return translations
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号