New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 874225 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug

Blocking:
issue 883977



Sign in to add a comment

Setting locale to en_CA will get en_GB

Project Member Reported by xiaoh...@chromium.org, Aug 14

Issue description

Chrome Version: 70.3519.3
OS: ChromeOS

What steps will reproduce the problem?
(1) Go to settings -> languages and input 
(2) Change display language to "English(Canada)" which should map to en_CA in code.
(3) "Restart" so the change applies
(4) Notice base::i18n::GetConfiguredLocale() returns "en_GB"

What is the expected result?
base::i18n::GetConfiguredLocale() should return "en_CA"

What happens instead?
base::i18n::GetConfiguredLocale() returns "en_GB"

 
Cc: updowndota@chromium.org
This happens here: https://cs.chromium.org/chromium/src/ui/base/l10n/l10n_util.cc?gsn=CheckAndResolveLocale&l=393

I think we just don't have English translations other than US and GB.
Thanks, that could explain en_CA -> en_GB.  We are also seeing similar problem with fr_CA -> fr
Cc: claudiomagni@chromium.org
Project Member

Comment 5 by bugdroid1@chromium.org, Aug 22

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/999dcf663f2e976371c41a94d74c0305b6fa12ba

commit 999dcf663f2e976371c41a94d74c0305b6fa12ba
Author: Muyuan Li <muyuanli@google.com>
Date: Wed Aug 22 18:12:12 2018

assistant: query locale from pref.

On ChromeOS, the locale from ICU is remapped to
eliminate locales that do not have translation,
such as en-CA -> en-GB, fr-CA -> fr. In assistant
though, we'll need the original locale to configure
features.

Bug: 874225, b/112604619
Test: Manual
Change-Id: Icf0016f9df45dd6af3f996d43bbe197d6a4e8915
Reviewed-on: https://chromium-review.googlesource.com/1182441
Commit-Queue: Muyuan Li <muyuanli@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Xiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585168}
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/ash/app_list/app_list_controller_impl.h
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/ash/assistant/assistant_cache_controller.h
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/ash/assistant/assistant_controller.h
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/ash/assistant/ui/main_stage/assistant_footer_view.h
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/ash/public/interfaces/voice_interaction_controller.mojom
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/ash/shelf/app_list_button.h
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/ash/system/palette/tools/metalayer_mode.h
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/ash/voice_interaction/voice_interaction_controller.cc
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/ash/voice_interaction/voice_interaction_controller.h
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/ash/voice_interaction/voice_interaction_controller_unittest.cc
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/chrome/browser/chromeos/arc/voice_interaction/fake_voice_interaction_controller.cc
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/chrome/browser/chromeos/arc/voice_interaction/fake_voice_interaction_controller.h
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client.cc
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client.h
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client_unittest.cc
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/chromeos/services/assistant/assistant_manager_service_impl.h
[modify] https://crrev.com/999dcf663f2e976371c41a94d74c0305b6fa12ba/chromeos/services/assistant/service.h

Status: WontFix (was: Untriaged)
based on comment #2, it seems expected behavior.
Cc: rdevlin....@chromium.org
Status: Available (was: WontFix)
This is something that should be addressed in the future.

In particular, it's causing a headache with an extension we're developing. We want to provide separate localization files for en-CA, but because Chrome reports converts en-CA to en-GB, the extensions system applies the en-GB localization instead of the en-CA one.

AFAICT there is no way to provide Canadian English localization in a Chrome extension/app due to this.

Devlin, do you happen to know of any workarounds for this?
Hmm, I don't, sorry.  Seems like the right thing to do would be have a GetLanguageForBuiltInMessages() and GetRealUILanguage(), which could return different things.  But no idea how complex doing something like that would be.
Cc: michae...@chromium.org
Labels: -M-70 M-71
We'll try to find a solution for this in M71. I'm a bit worried we could break things (we need to make sure "new" languages fall back to the locales they used to be converted to) depending on how far down in the system we make the change, though.
Blocking: 883977
Cc: yyushkina@chromium.org ovanieva@chromium.org
This requires more thought. The i18n system is baked into //extensions/common, but the language pref is more browser-side. The application locale is set globally when Local State is loaded, but language prefs are per-profile....
Cc: frechette@chromium.org ma...@chromium.org anthonyvd@chromium.org
Adding some more relevant folks. Ideally your solution should not affect the language pref browser side and only affect the relevant extensions since the language pref affects many pieces in the browser, so you're likely to have unintended consequences if you make changes to it.

@mathp: In general I think we should dedicate some resources to understand language settings on Chrome OS vs. the browser.
Yes, that's just a somewhat difficult thing to do because the low-level extensions framework is simply getting its locale info from l10n slash ICU.

Maybe we could add ExtensionsClient::GetPreferredLanguage() but I'm not even sure when we'd set that.
Project Member

Comment 14 by bugdroid1@chromium.org, Oct 18

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/693d01a674be72cb5ee4bf1f0c622189e7e05b37

commit 693d01a674be72cb5ee4bf1f0c622189e7e05b37
Author: Michael Giuffrida <michaelpg@chromium.org>
Date: Thu Oct 18 00:42:38 2018

Use preferred language in extension i18n

When localizing an extension, prioritize the user's preferred language
over the application locale.

Normally, these are the same. In some cases, they differ. For example,
the user may choose to display Chrome in "en-CA" (the intl.app_locale
pref), but because we don't have translations for that, the actual
UI locale is "en-GB".

This CL makes extensions try to use the user's preferred locale for i18n
("en_CA"), falling back to the UI locale ("en_GB") if no locale
directory is found for the preferred locale.

This change also updates the "current_locale" manifest key to reflect
the user's preferred locale, or the UI locale if intl.app_locale is
unset.

Note: Like the application locale, the preferred locale is only set at
startup (and in certain situations in CrOS). If the user changes their
intl.app_locale pref, they have to restart Chrome before extensions are
re-localized, just like before.

Bug: 874225
Change-Id: I1aabe3c3680b77d6522193e764aec15a3d618d2d
Reviewed-on: https://chromium-review.googlesource.com/c/1244666
Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600619}
[modify] https://crrev.com/693d01a674be72cb5ee4bf1f0c622189e7e05b37/chrome/browser/browser_process.h
[modify] https://crrev.com/693d01a674be72cb5ee4bf1f0c622189e7e05b37/chrome/browser/browser_process_impl.cc
[modify] https://crrev.com/693d01a674be72cb5ee4bf1f0c622189e7e05b37/chrome/browser/browser_process_impl.h
[modify] https://crrev.com/693d01a674be72cb5ee4bf1f0c622189e7e05b37/chrome/browser/chrome_browser_main.cc
[modify] https://crrev.com/693d01a674be72cb5ee4bf1f0c622189e7e05b37/chrome/browser/chromeos/base/locale_util.cc
[modify] https://crrev.com/693d01a674be72cb5ee4bf1f0c622189e7e05b37/chrome/browser/translate/translate_manager_render_view_host_unittest.cc
[modify] https://crrev.com/693d01a674be72cb5ee4bf1f0c622189e7e05b37/chrome/browser/ui/search/local_ntp_test_utils.cc
[modify] https://crrev.com/693d01a674be72cb5ee4bf1f0c622189e7e05b37/chrome/test/base/scoped_browser_locale.cc
[modify] https://crrev.com/693d01a674be72cb5ee4bf1f0c622189e7e05b37/chrome/test/base/testing_browser_process.cc
[modify] https://crrev.com/693d01a674be72cb5ee4bf1f0c622189e7e05b37/chrome/test/base/testing_browser_process.h
[modify] https://crrev.com/693d01a674be72cb5ee4bf1f0c622189e7e05b37/extensions/common/extension_l10n_util.cc
[modify] https://crrev.com/693d01a674be72cb5ee4bf1f0c622189e7e05b37/extensions/common/extension_l10n_util.h
[modify] https://crrev.com/693d01a674be72cb5ee4bf1f0c622189e7e05b37/extensions/common/extension_l10n_util_unittest.cc

Labels: Merge-Request-71
Requesting merge above revision to 71 to support en-CA version of Highlights app in Demo Mode.
Project Member

Comment 16 by sheriffbot@chromium.org, Oct 19

Labels: -Merge-Request-71 Hotlist-Merge-Approved Merge-Approved-71
Your change meets the bar and is auto-approved for M71. Please go ahead and merge the CL to branch 3578 manually. Please contact milestone owner if you have questions.
Owners: benmason@(Android), kariahda@(iOS), kbleicher@(ChromeOS), govind@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 17 by bugdroid1@chromium.org, Oct 22

Labels: -merge-approved-71 merge-merged-3578
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/31ddf98c1bf1e43383f1e061302c95cde46f0256

commit 31ddf98c1bf1e43383f1e061302c95cde46f0256
Author: Michael Giuffrida <michaelpg@chromium.org>
Date: Mon Oct 22 16:21:30 2018

[Merge to M71] Use preferred language in extension i18n

When localizing an extension, prioritize the user's preferred language
over the application locale.

Normally, these are the same. In some cases, they differ. For example,
the user may choose to display Chrome in "en-CA" (the intl.app_locale
pref), but because we don't have translations for that, the actual
UI locale is "en-GB".

This CL makes extensions try to use the user's preferred locale for i18n
("en_CA"), falling back to the UI locale ("en_GB") if no locale
directory is found for the preferred locale.

This change also updates the "current_locale" manifest key to reflect
the user's preferred locale, or the UI locale if intl.app_locale is
unset.

Note: Like the application locale, the preferred locale is only set at
startup (and in certain situations in CrOS). If the user changes their
intl.app_locale pref, they have to restart Chrome before extensions are
re-localized, just like before.

TBR=michaelpg@chromium.org

(cherry picked from commit 693d01a674be72cb5ee4bf1f0c622189e7e05b37)

Bug: 874225
Change-Id: I1aabe3c3680b77d6522193e764aec15a3d618d2d
Reviewed-on: https://chromium-review.googlesource.com/c/1244666
Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#600619}
Reviewed-on: https://chromium-review.googlesource.com/c/1292727
Reviewed-by: Michael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/branch-heads/3578@{#212}
Cr-Branched-From: 4226ddf99103e493d7afb23a4c7902ee496108b6-refs/heads/master@{#599034}
[modify] https://crrev.com/31ddf98c1bf1e43383f1e061302c95cde46f0256/chrome/browser/browser_process.h
[modify] https://crrev.com/31ddf98c1bf1e43383f1e061302c95cde46f0256/chrome/browser/browser_process_impl.cc
[modify] https://crrev.com/31ddf98c1bf1e43383f1e061302c95cde46f0256/chrome/browser/browser_process_impl.h
[modify] https://crrev.com/31ddf98c1bf1e43383f1e061302c95cde46f0256/chrome/browser/chrome_browser_main.cc
[modify] https://crrev.com/31ddf98c1bf1e43383f1e061302c95cde46f0256/chrome/browser/chromeos/base/locale_util.cc
[modify] https://crrev.com/31ddf98c1bf1e43383f1e061302c95cde46f0256/chrome/browser/translate/translate_manager_render_view_host_unittest.cc
[modify] https://crrev.com/31ddf98c1bf1e43383f1e061302c95cde46f0256/chrome/browser/ui/search/local_ntp_test_utils.cc
[modify] https://crrev.com/31ddf98c1bf1e43383f1e061302c95cde46f0256/chrome/test/base/scoped_browser_locale.cc
[modify] https://crrev.com/31ddf98c1bf1e43383f1e061302c95cde46f0256/chrome/test/base/testing_browser_process.cc
[modify] https://crrev.com/31ddf98c1bf1e43383f1e061302c95cde46f0256/chrome/test/base/testing_browser_process.h
[modify] https://crrev.com/31ddf98c1bf1e43383f1e061302c95cde46f0256/extensions/common/extension_l10n_util.cc
[modify] https://crrev.com/31ddf98c1bf1e43383f1e061302c95cde46f0256/extensions/common/extension_l10n_util.h
[modify] https://crrev.com/31ddf98c1bf1e43383f1e061302c95cde46f0256/extensions/common/extension_l10n_util_unittest.cc

Labels: Merge-Merged-71-3578
The following revision refers to this bug: 
https://chromium.googlesource.com/chromium/src.git/+/31ddf98c1bf1e43383f1e061302c95cde46f0256

Commit: 31ddf98c1bf1e43383f1e061302c95cde46f0256
Author: michaelpg@chromium.org
Commiter: michaelpg@chromium.org
Date: 2018-10-22 16:21:30 +0000 UTC

[Merge to M71] Use preferred language in extension i18n

When localizing an extension, prioritize the user's preferred language
over the application locale.

Normally, these are the same. In some cases, they differ. For example,
the user may choose to display Chrome in "en-CA" (the intl.app_locale
pref), but because we don't have translations for that, the actual
UI locale is "en-GB".

This CL makes extensions try to use the user's preferred locale for i18n
("en_CA"), falling back to the UI locale ("en_GB") if no locale
directory is found for the preferred locale.

This change also updates the "current_locale" manifest key to reflect
the user's preferred locale, or the UI locale if intl.app_locale is
unset.

Note: Like the application locale, the preferred locale is only set at
startup (and in certain situations in CrOS). If the user changes their
intl.app_locale pref, they have to restart Chrome before extensions are
re-localized, just like before.

TBR=michaelpg@chromium.org

(cherry picked from commit 693d01a674be72cb5ee4bf1f0c622189e7e05b37)

Bug: 874225
Change-Id: I1aabe3c3680b77d6522193e764aec15a3d618d2d
Reviewed-on: https://chromium-review.googlesource.com/c/1244666
Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#600619}
Reviewed-on: https://chromium-review.googlesource.com/c/1292727
Reviewed-by: Michael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/branch-heads/3578@{#212}
Cr-Branched-From: 4226ddf99103e493d7afb23a4c7902ee496108b6-refs/heads/master@{#599034}
Project Member

Comment 19 by bugdroid1@chromium.org, Nov 2

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ce0ec6fc14e4b07ae2d17fddd3c329cc38c8e004

commit ce0ec6fc14e4b07ae2d17fddd3c329cc38c8e004
Author: Michael Giuffrida <michaelpg@chromium.org>
Date: Fri Nov 02 02:57:41 2018

Partial revert of "Use preferred language in extension i18n"

This is a logical revert of "Use preferred language in extension i18n"
(commit 693d01a674be72cb5ee4bf1f0c622189e7e05b37). Because of some
intervening changes causing more complicated merges, it's simpler to
just undo the side effects of the original change, leaving the changed
boilerplate intact.

Reason for revert: Testing perf regression in  crbug.com/898191 

If this exonerates the original CL, we will revert this change.
Otherwise, we will clean up the boilerplate added for the original CL.

Original change's description:
> Use preferred language in extension i18n
>
> When localizing an extension, prioritize the user's preferred language
> over the application locale.
>
> Normally, these are the same. In some cases, they differ. For example,
> the user may choose to display Chrome in "en-CA" (the intl.app_locale
> pref), but because we don't have translations for that, the actual
> UI locale is "en-GB".
>
> This CL makes extensions try to use the user's preferred locale for i18n
> ("en_CA"), falling back to the UI locale ("en_GB") if no locale
> directory is found for the preferred locale.
>
> This change also updates the "current_locale" manifest key to reflect
> the user's preferred locale, or the UI locale if intl.app_locale is
> unset.
>
> Note: Like the application locale, the preferred locale is only set at
> startup (and in certain situations in CrOS). If the user changes their
> intl.app_locale pref, they have to restart Chrome before extensions are
> re-localized, just like before.
>
> Bug: 874225
> Change-Id: I1aabe3c3680b77d6522193e764aec15a3d618d2d
> Reviewed-on: https://chromium-review.googlesource.com/c/1244666
> Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
> Reviewed-by: Scott Violet <sky@chromium.org>
> Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#600619}

Bug:  898191 
Change-Id: Iaddceb16d61ffc5572a25ed31276443ea5b5baa4
Reviewed-on: https://chromium-review.googlesource.com/c/1308765
Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org>
Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604819}
[modify] https://crrev.com/ce0ec6fc14e4b07ae2d17fddd3c329cc38c8e004/extensions/common/extension_l10n_util.cc
[modify] https://crrev.com/ce0ec6fc14e4b07ae2d17fddd3c329cc38c8e004/extensions/common/extension_l10n_util_unittest.cc

Project Member

Comment 20 by bugdroid1@chromium.org, Nov 13

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/df2c70fcdb46d29057b48084c2571f9373ba4eff

commit df2c70fcdb46d29057b48084c2571f9373ba4eff
Author: Mike Wittman <wittman@chromium.org>
Date: Tue Nov 13 20:12:03 2018

Revert "Partial revert of "Use preferred language in extension i18n""

This reverts commit ce0ec6fc14e4b07ae2d17fddd3c329cc38c8e004.

Reason for revert: While the perf regression may have been caused by the original CL, it was transient. 

Original change's description:
> Partial revert of "Use preferred language in extension i18n"
> 
> This is a logical revert of "Use preferred language in extension i18n"
> (commit 693d01a674be72cb5ee4bf1f0c622189e7e05b37). Because of some
> intervening changes causing more complicated merges, it's simpler to
> just undo the side effects of the original change, leaving the changed
> boilerplate intact.
> 
> Reason for revert: Testing perf regression in  crbug.com/898191 
> 
> If this exonerates the original CL, we will revert this change.
> Otherwise, we will clean up the boilerplate added for the original CL.
> 
> Original change's description:
> > Use preferred language in extension i18n
> >
> > When localizing an extension, prioritize the user's preferred language
> > over the application locale.
> >
> > Normally, these are the same. In some cases, they differ. For example,
> > the user may choose to display Chrome in "en-CA" (the intl.app_locale
> > pref), but because we don't have translations for that, the actual
> > UI locale is "en-GB".
> >
> > This CL makes extensions try to use the user's preferred locale for i18n
> > ("en_CA"), falling back to the UI locale ("en_GB") if no locale
> > directory is found for the preferred locale.
> >
> > This change also updates the "current_locale" manifest key to reflect
> > the user's preferred locale, or the UI locale if intl.app_locale is
> > unset.
> >
> > Note: Like the application locale, the preferred locale is only set at
> > startup (and in certain situations in CrOS). If the user changes their
> > intl.app_locale pref, they have to restart Chrome before extensions are
> > re-localized, just like before.
> >
> > Bug: 874225
> > Change-Id: I1aabe3c3680b77d6522193e764aec15a3d618d2d
> > Reviewed-on: https://chromium-review.googlesource.com/c/1244666
> > Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
> > Reviewed-by: Scott Violet <sky@chromium.org>
> > Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#600619}
> 
> Bug:  898191 
> Change-Id: Iaddceb16d61ffc5572a25ed31276443ea5b5baa4
> Reviewed-on: https://chromium-review.googlesource.com/c/1308765
> Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org>
> Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#604819}

TBR=lazyboy@chromium.org,michaelpg@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug:  898191 
Change-Id: Iead107f46039f01b5d5b97b36d1b8fb242f0aee3
Reviewed-on: https://chromium-review.googlesource.com/c/1334194
Reviewed-by: Mike Wittman <wittman@chromium.org>
Reviewed-by: Michael Giuffrida <michaelpg@chromium.org>
Commit-Queue: Mike Wittman <wittman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607719}
[modify] https://crrev.com/df2c70fcdb46d29057b48084c2571f9373ba4eff/extensions/common/extension_l10n_util.cc
[modify] https://crrev.com/df2c70fcdb46d29057b48084c2571f9373ba4eff/extensions/common/extension_l10n_util_unittest.cc

Sign in to add a comment