The Account MFE provides the ability to change the platform language using the hardcoded options (source is here):
On other hand, the legacy frontend (all the non-MFE parts) including the header language selector uses the Dark Lang config to define languages users could use (aka Released Languages).
Furthermore, as @regis described in this how-to the DarkLang middleware filters the user’s browser preferred languages so the anonymous user will see a translated version of the platform only if their browser’s preferred language (the Accept-Language
header) will be presented in the dark lang released languages list.
Now the problem part.
If to choose the language which was not added to dark lang released languages:
- language cookies are set and MFE/legacy frontends are translated correctly
- BUT the header language selector doesn’t have the option we’ve used, so it shows the default (English):
My idea:
- add the API endpoint to get a list of released languages (pretty easy). I suspect that I could update the existing endpoint, but I didn’t search for it yet. Any hints are welcome here.
- filter MFEs supported languages using the received released languages list and show only those options for selection on the account page
Pros:
- language selectors are consistent
- more control over the platform configuration (e.g. I don’t want to have partially translated language X available for learners, so I can configure it in the site admin)
Why don’t I just implement it?
- I don’t know what plans for dark lang does edx have - will it be still used? removed?
- Why does the hardcoded list of languages in the Account MFE include only these languages? What are the plans for extending that list?
I will be happy to fix this issue