home / django_tickets / tickets

tickets: 8626

This data as json

id created changetime last_pulled_from_trac stage status component type severity version resolution summary description owner reporter keywords easy has_patch needs_better_patch needs_tests needs_docs ui_ux
8626 2008-08-28 00:38:17 2011-09-28 16:12:17 2022-03-06 03:42:45.068838 Accepted closed Internationalization Uncategorized Normal dev wontfix Translations from "en_US" locale being used even though request.LANGUAGE_CODE is "en" I've got a situation where even though the template has request.LANGUAGE_CODE=="en", the "en_US" translations are being rendered instead of the "en" translations. Furthermore, if request.LANGUAGE_CODE=="en-gb", the "en_GB" translation '''is''' being pulled back, correctly. In summary: * if LANGUAGE_CODE=="en" -> pulls back "en_US" translations (incorrect) * if LANGUAGE_CODE=="en-gb" -> pulls back "en_GB" translations (expected result) * if LANGUAGE_CODE=="en-us" -> pulls back "en_US" translations (expected result) To demonstrate the problem I put together and attached a tar.gz of a simple project directory: 1. A homepage that has a dropdown control for selecting/setting the user's chosen language, choices are "en", "en-gb" and "en-us". The form sets the request.LANGUAGE_CODE via the set-language view (django.conf.urls.i18n). urls.py is setup to activate the set-language view when user clicks Submit. The homepage itself lives at /index.html/ 2. Three locale translations corresponding, i.e. "en", "en_GB" and "en_US" in the locale subdir. I've localized the text "Homepage" with different text strings for each of the three locales. django.po 3. A settings.py which specifies the three LANGUAGES, a LANGUAGE_CODE of "en". It also pulls in the LocaleMiddleware as is necessary for locale translations. I think the other settings/files included are not relevant to the problem (e.g. the sqlite_db database file, etc), they're only included to form a runnable project. I've been able to show this behaviour in 1.0-beta_2-SVN-8643 - simply go to the homepage at /index.html/ and choose the different language values and submit. The page refreshes to show the current value of request.LANGUAGE_CODE and also which translation has been pulled back. nobody francisoreilly locale language en-us en-US 0 1 1 0 0 0
Powered by Datasette · Queries took 1.127ms