Language settings unconsistency

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 :slight_smile:

3 Likes

@Evgen_Dyudyunov thanks for the insightful post! You bring up a lot of good points, it seems any solution we implement should:

  • Ensure a consistent source of truth for available languages
    • You mentioned an API for this, that has also been discussed here, I haven’t fully thought through the implementation details of that, and I’m not sure how that could/would fit in with atlas and the OEP-58 plans for atlas
  • Ensure available languages work system wide
    • When a language is selected, the setting should be respected globally
    • Does this make sense with different roles? Should admins have access to more/different languages than learners?

There are definitely more things to think through with this, considering system/browser language settings and site overrides, as well as how new languages are added (the previously linked comment mentions overrides and custom locales)

I’m looking forward to doing whatever it takes to turn these thoughts and ideas into action items!

3 Likes