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

Issue 913345 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 9
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 1
Type: Bug



Sign in to add a comment

MacPWAs: Reports of menu items in wrong language

Project Member Reported by ccameron@chromium.org, Dec 10

Issue description

There are reports that menu items appear in the wrong language in PWAs.

The language is selected here
https://cs.chromium.org/chromium/src/chrome/app_shim/chrome_main_app_mode_mac.mm?rcl=5258d4567703372638ceaa5f84471c147b503f6f&l=186

 
Components: UI>Browser>WebAppInstalls
Owner: ellyjo...@chromium.org
Elly, you have this happening locally -- do you know what causes it (what we can do to reproduce it)?
Owner: sdy@chromium.org
Status: Assigned (was: Untriaged)
Cc: sdy@chromium.org
Owner: alancutter@chromium.org
P1 loadbalance -> alancutter

We "do something" with languages here:
https://cs.chromium.org/chromium/src/chrome/app_shim/chrome_main_app_mode_mac.mm?rcl=6a728e679b88c9b7353222da9829d3727b9f8c1f&l=192

And we build the menus (and look up the localized strings) here:
https://cs.chromium.org/chromium/src/chrome/browser/ui/cocoa/main_menu_builder.mm?rcl=6a728e679b88c9b7353222da9829d3727b9f8c1f&l=478

Attached a video for repro. Repro instructions (YMMV):
1. quit Chrome and all apps
2. change the default language
3. start Chrome (it will be in the right language)
4. start an app (it may or may not be in the right language)

language.mov
10.1 MB View Download
In ChromeAppModeStart_v4 after setting German as the default language I see
NSArray* preferred_languages = [NSLocale preferredLanguages]; // [de-DE, en-AU]
NSArray* supported_languages = [base::mac::OuterBundle() localizations]; // [de, he, ar, el, ja, fa, mr, en, uk, es_419, gu, zh_CN, kn, nb, am, es, sw, sl, pt_BR, da, et, it, bg, sk, pt_PT, sr, ms, ta, ml, sv, te, cs, ko, fil, hu, tr, pl, zh_TW, en_GB, vi, lv, lt, ru, fr, fi, id, nl, th, bn, ro, hr, hi, ca]
So we end up thinking none of the preferred languages are supported and default to locale being "en_US".
Commit comments in the earlier days of Chrome were much more colorful...
https://bugs.chromium.org/p/chromium/issues/detail?id=25578#c7

I wonder if there's a convention of matching just the first 2 characters when all else fails? Didn't find one, but would "stand to reason"
I'm quite puzzled about why we're unable to call OverrideLocaleWithCocoaLocale() in ChromeAppModeStart_v4(). I see that it fails to give us the right answer (I get en_GB instead of de) it's just puzzling why we get different answers for app shims vs the browser.

With German set as the OS default (followed by Australian English) I see:
  In the app shim:
    [base::mac::OuterBundle() preferredLocalizations] == ["en_GB", "en"]
    [NSLocale preferredLanguages] == ["de-DE", "en-AU"]
  In the browser:
    [base::mac::OuterBundle() preferredLocalizations] == ["de"]
    [NSLocale preferredLanguages] == ["de-DE", "en-AU"]

Bildschirmfoto 2018-12-22 um 11.50.57 AM.png
145 KB View Download
> I wonder if there's a convention of matching just the first 2 characters when all else fails? Didn't find one, but would "stand to reason"

Found some documentation we can point to: https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html
WIP CL: https://chromium-review.googlesource.com/c/chromium/src/+/1389477
before.png
189 KB View Download
after.png
193 KB View Download
Project Member

Comment 9 by bugdroid1@chromium.org, Jan 9

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

commit 0322dd07e0faba527507505eed07782f5e7dd761
Author: Alan Cutter <alancutter@chromium.org>
Date: Wed Jan 09 00:36:34 2019

RemoteMacViews: Strip language code out of language ID when setting locale

MacOS may return more than just the language code for the user's preferred
language IDs. This CL removes the excess data so we can operate on just
the preferred language code.

Before: https://bugs.chromium.org/p/chromium/issues/attachment?aid=372905&signed_aid=JtAfFDt-hrRQP2xuspyhxw==&inline=1
After: https://bugs.chromium.org/p/chromium/issues/attachment?aid=372906&signed_aid=d6YDIxqJ7JT0Q6kU6jd7Vw==&inline=1

Bug:  913345 
Change-Id: I80225a5e3b6c12484e45a5a9b53a4d61fc85102a
Reviewed-on: https://chromium-review.googlesource.com/c/1389477
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Reviewed-by: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620964}
[modify] https://crrev.com/0322dd07e0faba527507505eed07782f5e7dd761/chrome/app_shim/chrome_main_app_mode_mac.mm

Status: Fixed (was: Assigned)
Cc: viswa.karala@chromium.org
Labels: Needs-Feedback
Able to reproduce the issue on chrome version# 73.0.3626.0 using Mac 10.12.6 by launching the PWA(Killer Marmot: https://killer-marmot.appspot.com/web). Tried verifying the fix on latest chrome# 73.0.3665.0, but unable to launch the PWA app(Able to see the app installed successfully on Mac Dock, but app is not getting launched).

@Alan Cutter: Please find the above mentioned information and help us in verifying the fix.

Thanks!
++Correction: Latest chrome# 73.0.3666.0
#11: Strange, I don't think installing a PWA normally adds it to the dock. Instead it creates it under "<username>/Applications/Chrome Canary Apps". Can the PWA be launched from there?

A screen recording of the difficulty you're having would also be great to see in case this is a separate bug.
If the PWA hasn't been uninstalled between Chrome versions the problems with opening could be related to https://chromium.googlesource.com/chromium/src/+/f4dc2a844a6b7d2461a402738525d8614071d50a.

Comment 15 by viswa.karala@chromium.org, Jan 17 (5 days ago)

Tested the issue on chrome version# 73.0.3673.0 using Mac 10.12.6 with steps mentioned below:
1) As mentioned in comment# 11, tested the issue by launching  PWA(Killer Marmot: https://killer-marmot.appspot.com/web)
2) Installed killer-marmot PWA and navigated to Chrome://Apps and clicked on installed app, app didn't get launched
3) Able to see app menu on Dock, clicking on in didn't observed any response(app didn't get launched)

@Alan Cutter: Please find the above mentioned information and attached screencast for your reference and let us know if we missed anything and help us in verifying the fix.

Thanks!
913345.mp4
3.9 MB View Download

Comment 16 by alancutter@chromium.org, Jan 17 (5 days ago)

#15: How was this version of Chrome obtained/launched?
I'm able to launch Killer Marmot from chrome://apps in Chrome canary, maybe there's something broken with launching apps in other configurations.

Comment 17 by ccameron@chromium.org, Jan 17 (5 days ago)

crrev.com/623606 fixed some issues related to launches not happening (especially after install/uninstall)

Sign in to add a comment