Add ability to change Firefox Preview (browser UI) language
Why/User Benefit/User Problem
As a user, I want to experience the app in a language other than the system / phone language
Deps
- [x] AC API for switching languages
Acceptance Criteria (how do I know when I’m done?)
- [ ] I have the ability to change browser UI language separate from the system language
- [ ] Browser language will follow the system language by default
Mocks: https://miro.com/app/board/o9J_kwN9u-I=/ SVG asset for Language icon: https://dzwonsemrish7.cloudfront.net/items/1j0I1L1E282t24241N0l/language.svg
NOT in this issue
- #6502 Allow webpage content language selection
- expanding the locales we currently support #5496
This is just scoped to making the picker inside of Fenix, NOT inside AC
┆Issue is synchronized with this Jira Task
Issue #940 confirmed that Fenix's app UI language changes correctly when the user changes the Android system language.
AFAICT, Chrome's Language settings only configure the user's preferred language for web content (i.e. the Accept-Language HTTP header sent to web servers), not Chrome's app UI language.
GV bug https://bugzilla.mozilla.org/show_bug.cgi?id=1543823 is about letting the browser customize Gecko's Accept-Language HTTP header and/or making Gecko use the Android system language.
UX question to consider:
- Assume Android system language is en-US.
- User changes Fenix's language setting to en-CA.
- User then changes the Android system language to en-GB.
- Should Fenix's language setting preserve its non-default setting (en-CA) or switch to new system language (en-GB)?
- Assume Android system language is en-US.
- User changes Fenix's language setting to en-CA.
- User then changes the Android system language to en-GB.
- Should Fenix's language setting preserve its non-default setting (en-CA) or switch to new system language (en-GB)?
It feels to me like Fenix should be en-GB and and websites should be en-CA unless Fenix implements separate website and browser UI preferences for language.
Also, FWIW, Chrome also allows users to set up several languages based on priority, while Fennec only allows users to select a single one (likely because the preference applies to both UI and websites).
@vesta0 are we able to get a UX/product decision on this:
(From @cpeterso):
This issue is about "browser language", but does that just affect the app UI's language? Or should it also change the user's web content language preference (i.e. Gecko's
Accept-LanguageHTTP header sent to servers)? There's also a product question of whether the device's language should affect the app UI language and/or the Accept-Language HTTP header
There's also a product question of whether the device's language should affect the app UI language and/or the Accept-Language HTTP header.
GeckoView's default Accept-Language HTTP header is: language set by app (not necessarily the same as the app's UI language!) > OS language > "en-us,en".
@sblatz I believe this is not blocked on anything. Does this need to be implemented in A-C or Fenix?
@pocmo would this be useful for others or should we implement on the Fenix side?
Since we want that for every app we ship (e.g. Fennec, Focus and Firefox Lite have it, Fenix wants it) and since there's quite some complexity I think that should live in AC. Delphine filed that a while ago and I'll add the [Fenix] label to it: https://github.com/mozilla-mobile/android-components/issues/1557
removing the ux label - this is on our radar already as it's part of Q3 plans.
AC meta: https://github.com/mozilla-mobile/android-components/issues/1557#issuecomment-506413721
This is dependent on AC in the sense that we are going to use https://github.com/mozilla-mobile/android-components/issues/3584, but we are not dependent on their UI element :)
Removing the AC label because the above linked ticket has been closed
@lime124 can we reference Focus designs for this feature and iterate on improvements afterwards?
Progress report:
See the board here: https://miro.com/app/board/o9J_kwN9u-I=/
I’ve started the work on this project today. Although not all the screens in this feature have been mocked up, the user flow is fairly complete.
In this user flow and mockups, users have the maximum flexibility to:
- Choose one “Menus and dialogs” language
- Order “Web content” language(s)
Both may be set independently from the Android System language. As you’ll see on the board below, this feature isn’t as simple as designing a single menu.
I haven’t had the time to tackle this specific corner case: “What happens to the language(s) set under this menu, when the Android system language changes? Does it propagate? If so, what are the logic/rules?”
Progress report:
See the board here: https://miro.com/app/board/o9J_kwN9u-I=/
I’ve spent today designing policies around how OS vs. Firefox vs. web content languages interact.
I know that we want a separate language options for menus/dialogs and web content. This will solve some of our problems.
I also set out to solve the problem @cpeterso wrote in https://github.com/mozilla-mobile/fenix/issues/220#issuecomment-484572922:
- Assume Android system language is en-US.
- User changes Fenix's language setting to en-CA.
- User then changes the Android system language to en-GB.
- Should Fenix's language setting preserve its non-default setting (en-CA) or switch to new system language (en-GB)?
As a solution, I recommend:
- Under “Menus and dialogs language”, have an option called “Follow device language”. This option should be default policy, unless changed manually by the users
- Under “Web content language”, also have an option called “Follow device language”. This option should be on top of the list, unless changed manually by the users.
My reasoning are as follows:
- If users change the system language, they probably expect the browser and web content language to also follow. So we set the default policy to “Follow device language”.
- A portion of users will want to override this “follow” behaviour. To do that, they can go to Firefox Language Settings.
- There are 2 separate items within Firefox Language Settings: “Menus and dialogs language” and “Web content language”. This separation helps users realise that changing one item doesn’t necessarily change the other item.
Thanks to “Follow device language”, our default policy will work for the large majority of users, most of the time.
My concern is this: while it’s possible to set “Menus and dialogs” to “Follow device language”, there is no way for us to say “For all web content, follow device language”.
Either way, this project is now ready for walkthrough, so I will schedule a time to sit down with @vesta0 and Engineering.
@cpeterso do we have hooks in GV to change language for webpage content?
After walk through with Product and Engineering teams, this project is now ready to hand off to Engineering.
See the board: https://miro.com/app/board/o9J_kwN9u-I=/ SVG asset for Language icon: https://dzwonsemrish7.cloudfront.net/items/1j0I1L1E282t24241N0l/language.svg
- For MVP, we will only have the ability to change Browser language.
- There’s a new policy to handle Webpage Content language when a new Browser language has been selected. User-selected language goes on top. A sensible fallback like English goes under it.
- For post-MVP, we will split the Webpage Content language work in two: the page itself, and its edit mode
- The design specified having two names for each language: endonym and exonym. If L10N doesn’t have these values, then this feature can still ship with only one name per language.
@cpeterso do we have hooks in GV to change language for webpage content?
GV honors the system language by default (i.e. Gecko's HTTP requests set the Accept-Language HTTP header to match the system language, issue #940). Fenix can override Gecko's list of preferred languages using the GeckoRuntimeSettings#setLocales API:
https://mozilla.github.io/geckoview/javadoc/mozilla-central/org/mozilla/geckoview/GeckoRuntimeSettings.html#setLocales-java.lang.String:A-
@liuche Do we have the translations for the language names (endonym and exonym) available somewhere? Also, I saw that some of our translation files are not complete (for example, the Catalan one), so I'm thinking we should not include these ones in our list since it will be a bit weird for the user to have only 2-3 strings translated.
@BranescuMihai @liuche As far as I’m aware, Firefox Desktop has endonym, but the exonyms are only in English. Click “Select your preferred language” on this page: https://www.mozilla.org/en-US/firefox/all/#product-desktop-release
If exonyms aren’t available in any other language, it’s fine to only use the English exonyms.
https://developer.android.com/reference/android/icu/text/LocaleDisplayNames might be worth trying, if that has all the data you need.
Otherwise we've done this a few times, and we can provide a dataset.
Side note, we should handle release-ready localizations independently of the language chooser. In particular on Nightly, it's important that localizers can start testing their strings, even if they've only done 5 of them by now.