Replies: 3 comments
-
It's a good idea, provides a sensible default value for locale based on the request. I like detecting best case defaults automatically, with enough room for configurations. Maybe we can provide a way for the Django app (via
|
Beta Was this translation helpful? Give feedback.
-
There is already a complicated logic for django to find the closest locale for user https://github.com/django/django/blob/master/django/middleware/locale.py it supports reading the language/locale from :
So I guess we can only have an option to get locale from what this middleware has set or get the locale from LANGUAGE_CODE in settings.py |
Beta Was this translation helpful? Give feedback.
-
Yeah seems good, we won't need to do what's already done plus it'll be a better integration. So the request carries the proper language code. There is also django.utils.translation.get_language_from_request(). We can provide a way for the app to specify the order (priority) to pick the locale from request (using any of the above methods), or an explicit settings (so the app has an option to enforce the locale). |
Beta Was this translation helpful? Give feedback.
-
The idea is to let
django_jalali
uses Django locale rather than system level locale when printing dates.Given these settings
And this change:
It does work in some cases. However if the user has messed up locale settings in browser or user is from outside of Iran with different browser settings, Django
get_language
function returnsen
orde
or any other locale and the date is going to be printed in English.cc @Alireza2n @farzadghanei
Beta Was this translation helpful? Give feedback.
All reactions