Bug 159693 - platformUserPreferredLanguages on Mac should not try to put the region into the language
Summary: platformUserPreferredLanguages on Mac should not try to put the region into t...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords: InRadar
Depends on: 156993
Blocks: 90906
  Show dependency treegraph
 
Reported: 2016-07-12 15:37 PDT by Filip Pizlo
Modified: 2016-07-12 17:10 PDT (History)
7 users (show)

See Also:


Attachments
the patch (6.00 KB, patch)
2016-07-12 15:40 PDT, Filip Pizlo
ap: review+
Details | Formatted Diff | Diff
patch for landing (8.49 KB, patch)
2016-07-12 15:50 PDT, Filip Pizlo
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2016-07-12 15:37:21 PDT
Currently, navigator.language is the thing that we use as the BCP-47 tag in our Intl code when certain APIs are called without a locale argument.  That mostly based sense, and is deeply wired into our engine.

In bug 156993, we made Intl aware of the region as a separate thing from the language by having platformUserPreferredLanguages() return something like a BCP-47 tag that was <language>-<region>.  For example, if I told System Preferences that I want to speak English in Poland then we'd get "en-pl".  This had the effect of making Intl APIs format dates using Polish formatting, for example.

But this is an odd change, since that same function also feeds into navigator.language.  "en-pl" isn't what we want there, since my System Preferences settings did not mean to imply that I want to speak Polish-style English.  I don't think there is such a thing as Polish-style English (except in funny jokes, maybe).

It may be worthwhile to wire the region settings more elegantly into Intl, but if we do that, it should be via a mechanism that is separate from navigator.language.
Comment 1 Filip Pizlo 2016-07-12 15:40:47 PDT
Created attachment 283463 [details]
the patch
Comment 2 Alexey Proskuryakov 2016-07-12 15:43:10 PDT
Comment on attachment 283463 [details]
the patch

rs=me

We don't need to revert API tests, do we?
Comment 3 Filip Pizlo 2016-07-12 15:43:55 PDT
(In reply to comment #2)
> Comment on attachment 283463 [details]
> the patch
> 
> rs=me
> 
> We don't need to revert API tests, do we?

We may have to.  I will run them and see!
Comment 4 Filip Pizlo 2016-07-12 15:44:33 PDT
(In reply to comment #3)
> (In reply to comment #2)
> > Comment on attachment 283463 [details]
> > the patch
> > 
> > rs=me
> > 
> > We don't need to revert API tests, do we?
> 
> We may have to.  I will run them and see!

Yeah we have to.  I will revert https://trac.webkit.org/changeset/200105/trunk/Tools/TestWebKitAPI/Tests/mac/NavigatorLanguage.mm.
Comment 5 Filip Pizlo 2016-07-12 15:50:43 PDT
Created attachment 283465 [details]
patch for landing

Also reverted the API test.
Comment 6 Filip Pizlo 2016-07-12 17:09:53 PDT
Landed in https://trac.webkit.org/changeset/203141
Comment 7 Radar WebKit Bug Importer 2016-07-12 17:10:18 PDT
<rdar://problem/27313190>