openedx / frontend-app-account

Open edX micro-frontend application for managing user account information.
GNU Affero General Public License v3.0
17 stars 121 forks source link

Can't change site to some languages #1052

Open mariajgrimaldi opened 3 months ago

mariajgrimaldi commented 3 months ago

Expected behavior

Changing the language for the site should make text appear in other languages.

Actual behavior

For some languages, it works, but after reloading the page; for others it doesn't, and it goes back to English.

Steps to reproduce

  1. Open up account settings, like https://apps.redwood.demo.edly.io/account/#site-preferences
  2. Click or scroll to "Site Preferences".
  3. Click "Edit" next to "Site language".
  4. Pick a language. I chose French.
  5. Click "Save".
  6. Reload the page.
  7. Notice that the page is still in English and the setting has swapped back to English. (Not sure what happens if your site-wide default is set to something else.)

In a really weird twist, some languages work and some do not!

So a lot of them work, but not all of them. It seems my initial choice of French was sort of lucky here - I might not have realized this was broken otherwise.

Original issue: https://github.com/openedx/wg-build-test-release/issues/347

mariajgrimaldi commented 3 months ago

FYI @arbrandes @brian-smith-tcril: I'm not sure where's the issue here, but still, the account MFE doesn't recognize some of the languages, and for those who do, the page stays in the previous language unless it's reloaded.

This might be a bigger issue, but I think it's a good place to start.

brian-smith-tcril commented 3 months ago

Looking at the account MFE specifically (https://github.com/openedx/openedx-translations/blob/main/translations/frontend-app-account/src/i18n/messages/)

Bahasa Indonesia - No luck. The preference sticks, but the site does not change.

I assume this is coming from https://github.com/openedx/openedx-translations/blob/main/translations/frontend-app-account/src/i18n/messages/id.json, which appears to have English strings in it

Français - No luck.

It seems we only have fr_CA in the account MFE https://github.com/openedx/openedx-translations/blob/main/translations/frontend-app-account/src/i18n/messages/fr_CA.json

한국어 (대한민국) (Korean, RoK) - No luck. Site does not change, preference does not stick.

There is no ko file in there

mariajgrimaldi commented 3 months ago

Thank you, @brian-smith-tcril; I understand better now. Do you know what the process is for supporting those languages? At least for the ones listed in the account MFE.

mariajgrimaldi commented 3 months ago

Also, @brian-smith-tcril: there's a CORS error when changing the language from the account page. You can see it in detail here: https://github.com/openedx/wg-build-test-release/issues/347#issuecomment-2137186119

We have a similar cors error in the account MFE when trying to disconnect a TPA account association: https://github.com/openedx/wg-build-test-release/issues/376#issue-2328128813

Is this likely related to why the language changes are not reflected immediately but after reloading? When changing the language, the CORS error in the account page also happens in Quince, so the changes are not seen immediately either.

mariajgrimaldi commented 3 months ago

So... I tested this in the quince sandbox, and it failed:

Screencast from 03-06-24 15:19:59.webm

And then tested it in one of our internal installations (tutor k8s + other custom configurations for Kubernetes), and it worked, even for français. I'm going to go through our setup to see what I find.

mariajgrimaldi commented 3 months ago

So I was testing in our quince installation and realized that this only fails when the LMS_HOST differs from MFE_HOST. If they are the same, I can change the languages and the account MFE behaves correctly, because there is no CORS issue (same domain).

@cmltaWt0: is that what happens in your installation where you can change the languages?

cmltaWt0 commented 3 months ago

@mariajgrimaldi Yeap. LMS: https://axim-mfe.raccoongang.net/ MFE: https://apps.axim-mfe.raccoongang.net/

mariajgrimaldi commented 2 months ago

@arbrandes @brian-smith-tcril: What do you think about the CORS issue findings? I believe at least some of it might be related to the language not changing immediately but after reloading.

brian-smith-tcril commented 2 months ago

I haven't done any intensive investigation into the CORS issue but I would assume that it is something that needs to be addressed on the Tutor side.