带破折号的 LANGUAGE_CODE 不起作用:“es-mx、es-es、es-ar”但是“es”做
在 settings.py 中 LANGUAGE_CODE = 'es-mx'
或 LANGUAGE_CODE = 'es-ar'
不起作用,但 LANGUAGE_CODE = 'es'
或 LANGUAGE_CODE = 'mk'
在渲染模板时工作正常,I18N 在项目设置中处于活动状态,这就是 .mo .po 看起来像:
这是 i18n 上下文处理器信息:
{'语言': (('ar', '阿拉伯语'), ('az', '阿塞拜疆语'), ('bg', '保加利亚语'), ('bn', '孟加拉语'), ('bs' , '波斯尼亚语'), ('ca', '加泰罗尼亚语'), ('cs', '捷克语'), ('cy', '威尔士语'), ('da', '丹麦语'), ('de', '德语'), ('el', '希腊语'), ('en', '英语'), ('en-gb ', '英式英语'), ('es', '西班牙语'), ('es-ar', '阿根廷西班牙语'), ('es-mx', '墨西哥西班牙语'), ('es-ni', '尼加拉瓜西班牙语'), ('et', '爱沙尼亚语'), ('eu', '巴斯克语'), ('fa', '波斯语'), ('fi', '芬兰语'), ('fr', '法语'), ('fy-nl', '弗里斯兰语'), ('ga', '爱尔兰语'), ('gl', '加利西亚语'), ('他', '希伯来语'), ('嗨', '印地语'), ('hr', '克罗地亚语'), ('hu', '匈牙利语'), ('id', '印度尼西亚语'), ('是', '冰岛语'), ('它', '意大利语'), ('ja', '日语'), ('ka', '格鲁吉亚语'), ('km', '高棉语'), ('kn', '卡纳达语'), ('ko', '韩语'), ('lt', '立陶宛语'), ('lv', '拉脱维亚语'), ('mk', '马其顿语'), ('ml', '马拉雅拉姆语'), ('mn', '蒙古语'), ('nl', '荷兰语'), ('no', '挪威语'), ('nb', '挪威博克马尔语'), ('nn', '挪威尼诺斯克语'), ('pa', '旁遮普语' ), ('pl', '波兰语'), ('pt', '葡萄牙语'), ('pt-br', '巴西语葡萄牙语'), ('ro', '罗马尼亚语'), ('ru', '俄语'), ('sk', '斯洛伐克语'), ('sl', '斯洛文尼亚语'), ('sq', '阿尔巴尼亚语'), ('sr', '塞尔维亚语'), ('sr-latn', '塞尔维亚拉丁语'), ('sv', '瑞典语'), ('ta', '泰米尔语'), ('te', '泰卢固语'), ('th', '泰语'), ('tr', '土耳其语'), ('uk', '乌克兰语'), ('ur', '乌尔都语'), ('vi', '越南语'), ('zh-cn', '简体中文'), ('zh-tw', '繁体中文')), 'LANGUAGE_BIDI': False, 'LANGUAGE_CODE': 'es-ar'}
根据 django-i18n-docs “es-mx”和“es-ar”是标准 lang 格式。
我在这里错过了什么吗?提前致谢。
in settings.py LANGUAGE_CODE = 'es-mx'
or LANGUAGE_CODE = 'es-ar'
does not work, but LANGUAGE_CODE = 'es'
or LANGUAGE_CODE = 'mk'
works OK when rendering the templates, I18N is active en the project settings and this is how .mo and .po looks like:
and this is the i18n context processor information:
{'LANGUAGES': (('ar', 'Arabic'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('bn', 'Bengali'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en', 'English'), ('en-gb', 'British English'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy-nl', 'Frisian'), ('ga', 'Irish'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hu', 'Hungarian'), ('id', 'Indonesian'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('nl', 'Dutch'), ('no', 'Norwegian'), ('nb', 'Norwegian Bokmal'), ('nn', 'Norwegian Nynorsk'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-cn', 'Simplified Chinese'), ('zh-tw', 'Traditional Chinese')), 'LANGUAGE_BIDI': False, 'LANGUAGE_CODE': 'es-ar'}
According django-i18n-docs "es-mx" and "es-ar" are standard lang format.
Am I missing something here? thanks in advace.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我查看了 django 存储库 框架如何处理区域设置forder 结构,我找到了解决方案(请参阅文件夹名称):
感谢您的查看。
I looked in the django repository how the framework is handling the locale forder structure and I found the solution (see the folders name):
Thanks for viewing.
django 1.3.1 的 settings.py 文件中链接的文档重定向到: http:// www.i18nguy.com/unicode/language-identifiers.html
也许尝试使用 es-AR
我对 fr-FR 也有同样的问题。
希望对您有帮助。
The documentation linked in the settings.py file for django 1.3.1 redirect to : http://www.i18nguy.com/unicode/language-identifiers.html
Maybe try to use es-AR
I had the same problem for fr-FR.
Hope it helps you.