-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Receive email notification in my language #323
Comments
I observed the same. With my PR from #333 we will have the same language in the backend that we have in the frontend, because of sharing the language cookie We just need to read that cookie on the backend when the user B makes any request to it, and if it changed, update the language attribute on the user enttity for user B. Then we always have up to date preferred language for the user B. |
@lindenb1 and i would like to work on this issue next. To do this, we would like to remove the current usage of the Instead we would update Then we would adapt the code that sends invitation emails, to associate the email-address with the receiving |
@rvveber in the backend the email is sent to a user if we have one, so you will have access to |
Oh great! Even better
I didn't see that we could add any email address! |
You said:
But then you proposed:
Am I correct if I say this is in contradiction? If we update the field value on the user each time the cookie changes, we don't want to offer modifying it via the frontend because it will be confusing? I would expect the value to be set the first time I login, and then being editable in my settings via the frontend. This means that we can set it in the authentication backend and not via a middleware and the cookie? |
@virgile-dev may not be obvious enough? |
The cookie determines the backend django language for the request as per LocaleMiddleware. My original idea was to take that backend language which is (determined by cookie as of #333) for the user and persist it on his user entity. Because it would be a minimal solution. But maybe doing it on each request is unnecessary stress, if it only changes on language switch(set) anyways. Since there is also an existing user endpoint to update language, i revised the most minimal solution might be to instead update Both would change to the same lang
|
After external discussion with @sampaccoud we could agree on the process. Currently the frontend detects its language in this order:
And stores the detected language in a cookie. I will add a detection strategy after the cookie, that will get the users language attribute:
This way, when accessed from a new browser that has no cookie, or the cookie expired, we still get the users choosen language for the new cookie. On language switch, i will update And of course finally, i will adapt to send the email in the users.language with fallback to djangos default language (settings.LANGUAGE_CODE). Additional considerations: |
Bug Report
Problematic behavior
Even though my interface is in french I'm receiving notification emails in english.
Right the emails are sent in the language setting the sender using on the app. It should be the opposite.
The text was updated successfully, but these errors were encountered: