0π
β
I specified a language variable in my localStorage then I returned value to Content-Language header and after this Iβve could take the language value in my django request.
0π
I see two approach :
- Send the language value on every (interesting) request, as you proposed
- Or, keep it in user settings in the backend : you add a charfield on a custom user model. When you need the language value during a request, you can access it through
self.request.user.lang
. You will have to add a route to update the value when users click on the icons.
It depends on how usual the language value is needed ; if its often, it will be simpler to have it in the backend. But you must keep the value up to dateβ¦ Its a trade off π
Source:stackexchange.com