i18n.py 文件源码

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

项目:aiyprojects-raspbian 作者: google 项目源码 文件源码
def set_language_code(code, gettext_install=False):
    """Set the BCP-47 language code that the speech systems should use.

    Args:
      gettext_install: if True, gettext's _() will be installed in as a builtin.
          As this has global effect, it should only be done by applications.
    """
    global _language_code
    _language_code = code.replace('_', '-')

    if gettext_install:
        if not _locale_dir:
            raise ValueError('locale_dir is not set. Please call set_locale_dir().')
        language_id = code.replace('-', '_')
        t = gettext.translation(_LOCALE_DOMAIN, _locale_dir, [language_id], fallback=True)
        t.install()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号