标签: django locale
如何在Django中将语言代码转换为语言环境名称?
例如:
zh-cn
zh_CN
zh-Hans
zh_Hans
答案 0 :(得分:2)
from django.utils.translation import to_locale from django.conf import settings print to_locale(settings.LANGUAGE_CODE)