Open Bug 1908986 Opened 2 months ago Updated 25 days ago

Refetch language model information when app languages changes.

Categories

(Fenix :: Translations, defect, P2)

All
Android
defect

Tracking

(Not tracked)

People

(Reporter: olivia, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: leave-open, Whiteboard: [fxdroid][foundation][translations:130][avocado sprint])

Attachments

(2 files)

Steps to reproduce

  1. Begin the app in English
  2. Open translations sheet and downloads area, notice language names are in English.
  3. Change app language to any language
  4. Notice the UI is in the new language, but the language names are still in English. Additionally, the pivot considerations are not shown.

(Workaround: Hard close app will fetch the right language names.)

Expected behavior

Should automatically pick up correct language names and model statuses when the app language changes and show pivot languages on translations engine supported, non-English locales.

Actual behavior

Requires a hard close to fix.

Figma reference for more details on errant behavior and correct behavior:
https://www.figma.com/design/GT6oZLFw32LiCwKl5GOMWD/Full-Page-Translation?node-id=14269-42639&t=Q5aa5CwGEwjgmuVt-0

Any additional information?

To fix:

  • Listen to LocaleAction.UpdateLocaleAction action.
  • When the app language changes, call the actions FETCH_SUPPORTED_LANGUAGES and FETCH_LANGUAGE_MODELS to make sure new infromation is calculated.

(Setting as S3 because a work around exists, but the issue is a little bit closer to S2 from a user experience perspective.)

Assignee: nobody → ohall
Severity: -- → S3
Priority: -- → P1
Whiteboard: [fxdroid][foundation][translations:130]

This bug requires some more research. This might be an expected flow and we will have to work within those bounds or else add a new mechanism. Reasoning for this being not wholly unexpected is if I go to about:about on an English app language, change the app language to German, and reload about:about, it is still in English, even though there is a German localized version of this page. (Tested in release.) This corrects on a hard close. However, this page lives in Gecko and is likely following a similar process as the translations information.

Other option might be we need to find the display name in Fenix. (Not fully sure if we have access to the same display name library or just the Android one, so that might be a challenge.)
Edit: Realized this option of using Fenix known language APIs likely won't work because the language model API call is additionally sending information based on model sizing for the given locale, not just display names. For example, the size of the pivot language in non-English apps.

I'll see if I can identify other instances of aquiring localization information from Gecko to help determine the severity or possible workaround of this bug. I have a feeling this could be difficult to solve if it involves how languages in Gecko are packaged for distribution in Fenix. I'll try to find out more how language packs work as well.

Original issue of needing to listen for UpdateLocaleAction and fetch information is still there, but there seems to be other factors at play about when the Gecko side localizations are available based on development testing. A good diagnostic step will be a patch that does this could help make sure this issue is deeper than just needing to refresh languages. One concern I have is I'm not sure of the differences regarding release and development setup here, I'm using a multilocale build locally, but would like to find out more how this is distributed, in case it can switch language packs in release easier. This step would be a Part 1 of any fuller solution, at any rate.

This patch adds an observer to UpdateLocaleAction that makes the calls to fetch new language names
and model download sizes when a locale change occurs.

Pushed by ohall@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7f66267a993d
Part 1: Fetch new Android translations information on locale change r=android-reviewers,giorga

To fully solve this bug, it likely needs a follow-up. Part 1 is mostly to ensure the translations feature is fetching information as expected.

Keywords: leave-open

Hi Makoto,

I'm looking for some advice or recommendations on this bug. I suspect this situation is a known issue and there might be other bugs tracking it. Mostly wanted your take on the situation or if there is anything we can easily do to fix it or if it is a much bigger systematic change.

Some background:

  • The translations on Android feature gets its language names from here on the Gecko side
  • The bug is if the user switches the app language, without fully closing the app, then the language names remain in the original language.
    • For example:
      • Open the app in English -> English app should have the language names "English, French, German ..."
      • Change the app language to German (or any other language) -> this bug with language names "English, French, German ..."
        • German app should switch localization to the language names "Englisch, Französisch, Deutsch ..."
      • Closing and reopening the app will remedy the bug.

I noticed this behavior also happens on about:about, which I'm assuming the localization is on the Gecko side and also makes me think this is an older bug.

Please let me know if you have any recommendations, other bugs to connect this one too, or anything that could be interesting!

Flags: needinfo?(m_kato)

Video that shows the base problem.

STR for language names in translations dropdown:

  • Open app in English and observe English language names in translations language dropdown
  • Change app language to another language, in this video, it was changed to German
  • Observe the translations language dropdown is using English language names instead of German language names

Other STR for download languages page:
There bug is additionally impacting the Download languages translations page, (Translations Feature -> Page Settings -> Translation Settings -> Download languages page), because the Gecko layer appears to not know the set language is now in German.

Background on download languages page:

  • Download languages behaves different in non-English locales that support translations.
  • Additionally, the downloads are from the perspective of the app language. (For example, it doesn't make sense to download a "German" language model on a German app.)
  • The pivot language (currently only English) is downloaded in addition in these cases as well.
  • GeckoView JS call for this page. Key TranslationsParent call checking for locale.
Blocks: 1909674

Wn locale is changed by browser application, it will changes requestLocales . Then "intl:app-locales-changed" observer is notified since application locale is changed. So I guess that mozILocaleService.appLocaleAsLangTag will be updated to any locale.

Flags: needinfo?(m_kato)
Priority: P1 → P2
Whiteboard: [fxdroid][foundation][translations:130] → [fxdroid][foundation][translations:130][avocado sprint]
Assignee: ohall → nobody
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: