I would like i18n.set_language() to store the language into an eventually available user profile when a language is selected by a user.
Django should also use this to discover my language.
Is it a good idea ? If yes how could I do it ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
See How to override a view from an external Django app -> How to override without forking -> Overriding a view to make “i18n.set_language() to store the language into an eventually available user profile”
Copy django-user-accounts middleware and change
get_language_for_user.Place the middleware after
django.middleware.locale.LocaleMiddleware, because this sets the default language based on the request so that’s still useful for anonymous visitors, so you want this executed before your own middleware.