Despite selected language, Forms still rely on LANGUAGE_CODE to format datetime (demo included)
|Reported by:||houmie||Owned by:||nobody|
|Severity:||Normal||Keywords:||formats, i18n, l10n|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I have discussed this issue in stackoverflow and it seems to be a bug.
In a nutshell, despite creating custom formats.py, only the templates react to the selected language while the forms still rely on LANGUAGE_CODE
I have created a small live demo to show the problem. Please open the demo here: http://sandbox.chasebot.com/
When you click on British English, you can see how both the date- and time format within the template change accordingly, which is great.
Now if you click on Add, you will see how both the current date and time are populated for you in the form. However they still carry the American date format, instead of the selected British language.
The only way to fix this is to change
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'en-gb'
in settings.py. This approach would be obviously useless as its no longer dynamic and favors one group over the other. LANGUAGE_CODE should be the last priority since the selected language should have a higher priority. But this doesn't work when having custom formats.py for each language.
I have created custom formats.py to override the date and time formats for en and en_GB as described in the documentation so I am clueless what else I could do.
Please be so kind and download my demo (22 kb) from my dropbox (https://dl.dropbox.com/u/44307777/Sandbox.zip) or see attachment: All you have to do is to edit settings.py to adjust the path to sqlite.db.