本文整理汇总了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)
示例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.