OpenSlides / openslides-backend

Backend service for OpenSlides 4+
MIT License
6 stars 26 forks source link

Translations for password reset emails #994

Closed jsangmeister closed 2 years ago

jsangmeister commented 3 years ago

After https://github.com/OpenSlides/openslides-backend/issues/948 is implemented, we will need server-side translations for these mails. Either hardcoded with if-else (as long as it's just for this case) or (better) we need to use a python translation framework like babel.

jsangmeister commented 2 years ago

The better approach is to use a full framework. It can probably be implemented analogous to the website: https://github.com/OpenSlides/openslides.com

reiterl commented 2 years ago

It cannot be implemented analogous, because openslides.com uses flask and the backend is barebone. I don't know how to continue here. Babel is a way to extract the messages easily. The localization uses gettext. Gettext uses the locale of the Docker container, which is a generic one. It is not easy to switch the locale. Shouldn't the translated text be based on the request? I don't know, how to do that.

reiterl commented 2 years ago

We want the client to send the language with Accept Language in the header. We will pass the lang to the action, which get a translation function. Then translate the forget_password action.

reiterl commented 2 years ago

The commands pybabel compile/update/extract need a place to work. Should I include make commands for them?

jsangmeister commented 2 years ago

The commands pybabel compile/update/extract need a place to work. Should I include make commands for them?

yes

jsangmeister commented 2 years ago

done in https://github.com/OpenSlides/openslides-backend/pulls?q=is%3Apr+is%3Aclosed