当前位置: 首页>>代码示例>>Python>>正文


Python global_settings.LANGUAGES属性代码示例

本文整理汇总了Python中django.conf.global_settings.LANGUAGES属性的典型用法代码示例。如果您正苦于以下问题:Python global_settings.LANGUAGES属性的具体用法?Python global_settings.LANGUAGES怎么用?Python global_settings.LANGUAGES使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在django.conf.global_settings的用法示例。


在下文中一共展示了global_settings.LANGUAGES属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _is_supported_language

# 需要导入模块: from django.conf import global_settings [as 别名]
# 或者: from django.conf.global_settings import LANGUAGES [as 别名]
def _is_supported_language(lang: str) -> bool:
    from django.conf.global_settings import LANGUAGES

    return any(lang == supported_lang[0] for supported_lang in LANGUAGES) 
开发者ID:stellar,项目名称:django-polaris,代码行数:6,代码来源:utils.py

示例2: get_django_cldr_languages_intersection

# 需要导入模块: from django.conf import global_settings [as 别名]
# 或者: from django.conf.global_settings import LANGUAGES [as 别名]
def get_django_cldr_languages_intersection(dir):
    languages_intersection = []
    language_data_json = open(os.path.join(dir, "language-data.json"))
    languages = json.loads(language_data_json.read())["languages"]
    for lang_code, lang_data in languages.items():
        for i, (djlang_code, djlang_name) in enumerate(GLOBAL_LANGUAGES):
            if lang_code == djlang_code:
                autonym = lang_data[-1]
                languages_intersection += [(lang_code, autonym)]
    return sorted(set(languages_intersection))


# Get the language codes from the locale directories, and compare them to the
# intersecting set of languages between Django and Wikimedia CLDR.
# Use langauge autonyms from Wikimedia. 
开发者ID:WikipediaLibrary,项目名称:TWLight,代码行数:17,代码来源:base.py


注:本文中的django.conf.global_settings.LANGUAGES属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。