Andrea Grandi 🦕 on Nostr: What happens in a #Django app if user has language set to 'pt-PT' but only 'pt-BR' is ...
What happens in a #Django app if user has language set to 'pt-PT' but only 'pt-BR' is available?
In an app I have, we see it defaulting to 'pt-BR' instead of defaulting to 'en'.
The docs only mention what happens when for example 'pt' is available but not what happens when only another variant is available https://docs.djangoproject.com/en/4.2/topics/i18n/translation/#how-django-discovers-language-preference
I'm ending up implementing my own CustomLocaleMiddleware, but I'm wondering if I'm missing some easier setting.
#Python #development #webdev
In an app I have, we see it defaulting to 'pt-BR' instead of defaulting to 'en'.
The docs only mention what happens when for example 'pt' is available but not what happens when only another variant is available https://docs.djangoproject.com/en/4.2/topics/i18n/translation/#how-django-discovers-language-preference
I'm ending up implementing my own CustomLocaleMiddleware, but I'm wondering if I'm missing some easier setting.
#Python #development #webdev