#18769: Despite selected language, Forms still rely on LANGUAGE_CODE to format
datetime (demo included)
--------------------------------------+---------------------------------
Reporter: houmie | Owner: nobody
Type: Uncategorized | Status: new
Component: Internationalization | Version: 1.4
Severity: Normal | Keywords: formats, i18n, l10n
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+---------------------------------
I have discussed this issue in stackoverflow and it seems to be a bug.
'''Summary:'''
In a nutshell, despite creating custom formats.py, only the templates
react to the selected language while the forms still rely on LANGUAGE_CODE
'''Details:'''
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'
}}}
to
{{{
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/18769>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.