Reputation: 16325
I want Django to localize all dates (in all regions), but I don't want translations. It seems like for a date to be put into the right locale, we need to add its language to LANGUAGES
.
For dates to be localized, we also need USE_I18N = True
and USE_L10N = True
.
Is this even possible?
I don't want translations, because as long as the site is not fully translated, you will have a website that is only half-translated. This is an issue due to django, because its error messages are all translated.
Upvotes: 2
Views: 169
Reputation: 53754
The best approach for you is to store your data in your database as unix timestamps and then display them using javascript. This immidiately eliminates all the complex code you have for detecting the user's locale in django. With javascript it's a lot easier to do that, and also to display the time using the appropriate format.
toLocaleDateString is your friend
The toLocaleDateString() method returns a string with a language sensitive representation of the date portion of this date. The new locales and options arguments let applications specify the language whose formatting conventions should be used and allow to customize the behavior of the function. In older implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation dependent.
Upvotes: 1