fenix icon indicating copy to clipboard operation
fenix copied to clipboard

Add ability to change Firefox Preview (browser UI) language

Open bbinto opened this issue 7 years ago • 46 comments

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

bbinto avatar Jan 21 '19 19:01 bbinto

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:

  1. Assume Android system language is en-US.
  2. User changes Fenix's language setting to en-CA.
  3. User then changes the Android system language to en-GB.
  4. Should Fenix's language setting preserve its non-default setting (en-CA) or switch to new system language (en-GB)?

cpeterso avatar Apr 18 '19 15:04 cpeterso

  1. Assume Android system language is en-US.
  2. User changes Fenix's language setting to en-CA.
  3. User then changes the Android system language to en-GB.
  4. 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).

yoasif avatar Apr 18 '19 18:04 yoasif

@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-Language HTTP 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

sblatz avatar Jun 07 '19 17:06 sblatz

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".

cpeterso avatar Jun 07 '19 17:06 cpeterso

@sblatz I believe this is not blocked on anything. Does this need to be implemented in A-C or Fenix?

vesta0 avatar Jun 07 '19 22:06 vesta0

@pocmo would this be useful for others or should we implement on the Fenix side?

sblatz avatar Jun 11 '19 15:06 sblatz

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

pocmo avatar Jun 12 '19 08:06 pocmo

removing the ux label - this is on our radar already as it's part of Q3 plans.

lime124 avatar Jul 23 '19 03:07 lime124

AC meta: https://github.com/mozilla-mobile/android-components/issues/1557#issuecomment-506413721

sblatz avatar Sep 05 '19 18:09 sblatz

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

sblatz avatar Sep 23 '19 20:09 sblatz

Removing the AC label because the above linked ticket has been closed

ekager avatar Oct 03 '19 00:10 ekager

@lime124 can we reference Focus designs for this feature and iterate on improvements afterwards?

vesta0 avatar Oct 03 '19 05:10 vesta0

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:

  1. Choose one “Menus and dialogs” language
  2. 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?”

brampitoyo avatar Oct 31 '19 10:10 brampitoyo

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:

  1. Assume Android system language is en-US.
  2. User changes Fenix's language setting to en-CA.
  3. User then changes the Android system language to en-GB.
  4. 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:

  1. Under “Menus and dialogs language”, have an option called “Follow device language”. This option should be default policy, unless changed manually by the users
  2. 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:

  1. 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”.
  2. A portion of users will want to override this “follow” behaviour. To do that, they can go to Firefox Language Settings.
  3. 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.

brampitoyo avatar Nov 04 '19 04:11 brampitoyo

@cpeterso do we have hooks in GV to change language for webpage content?

sblatz avatar Nov 06 '19 23:11 sblatz

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.

brampitoyo avatar Nov 07 '19 04:11 brampitoyo

@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-

cpeterso avatar Nov 07 '19 21:11 cpeterso

@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 avatar Nov 28 '19 15:11 BranescuMihai

@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.

brampitoyo avatar Dec 02 '19 02:12 brampitoyo

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.

Pike avatar Dec 06 '19 17:12 Pike