Locale middleware: user language preference ignored when set to a value of the xx-yy form
|Reported by:||Owned by:||Simon Blanchard|
|Severity:||Keywords:||i18n Chinese locale localemiddleware get_language_from_request HTTP_ACCEPT_LANGUAGE|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I found there is a bug in method "get_language_from_request" in trans_real.py
I want to support Chinese language in django, but my LANGUAGE_CODE is "en-gb". I added locales in my browser in this order "zh-cn, de-de, en-us" in order to emulate different languages.
While debugging this application, it never hits "zh-cn" locale. It caused by normalizing function. It changes "zh-cn" to "zh_CN", but "zh_CN" is not in settings.LANGUAGES. So Chinese locale is always missed while the settings.LANGUAGE_CODE is not set to "zh-cn".
Change History (9)
comment:1 Changed 9 years ago by
|Owner:||changed from nobody to Simon Blanchard|
|Status:||new → assigned|
comment:6 Changed 9 years ago by
|Keywords:||localemiddleware get_language_from_request HTTP_ACCEPT_LANGUAGE added|
|Summary:||i18n failed in Chinese locale → Locale middleware: user language preference ignored when set to a value of the xx-yy form|