Clean up MozIntl
Categories
(Core :: Internationalization, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox85 | --- | fixed |
People
(Reporter: zbraniecki, Assigned: dminor)
References
Details
Attachments
(4 files)
With the flock of ECMA402 updates landing in SpiderMonkey(*), we should be able to clean up and reduce the scope of MozIntl quite substantially.
This should lead to perf wins due to bug 1504168 and related.
Reporter | ||
Updated•5 years ago
|
Updated•5 years ago
|
Reporter | ||
Comment 1•5 years ago
|
||
One thing that is left is locale management, and I'd like to explore an option to move locale management used in mozIntl to https://searchfox.org/mozilla-central/source/js/xpconnect/src/XPCLocale.cpp#117-141 - we should just chose the right locale fallback chain for JS environment separately for chrome/non-chrome and then
new Intl.DateTimeformat()
in chrome process should return the Firefox UI locale, while in web process should return the web exposed locale chain. This would remove a bit part of mozIntl.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
Having looked at this and Bug 1639515, I think it makes sense to do the cleanup Zibi suggested in Comment 1 first, and then rebase and land Bug 1639515 afterwards. I can pick up a few of the changes unrelated to DisplayNames from 1639515 as part of this bug.
Assignee | ||
Comment 3•5 years ago
|
||
Assignee | ||
Comment 4•5 years ago
|
||
Not that we use RegionalPrefLocales rather than AppLocale in
xpc_LocalizeRuntime, the wrappers in MozIntl to set this up are no longer
needed.
Depends on D98390
Assignee | ||
Comment 5•5 years ago
|
||
Keeping MozIntl in sync with Intl will allow people to use MozIntl consistently
until we're ready to remove it completely. This is based on work done by André
Bargull for Bug 1639515.
Depends on D98391
Assignee | ||
Comment 6•5 years ago
|
||
This adds Locale to MozIntl and uses it to replaces some instances where we
used regular expressions to parse language tags. It is based on work done by
André Bargull in Bug 1639515.
Depends on D98392
Assignee | ||
Comment 7•5 years ago
|
||
Comment 9•5 years ago
|
||
Backed out for perma failures.
Log: https://treeherder.mozilla.org/logviewer?job_id=323483011&repo=autoland&lineNumber=4671
Backout: https://hg.mozilla.org/integration/autoland/rev/6b65a4a632e9d24bb048fdcb261f7777d032cc0b
Assignee | ||
Comment 10•5 years ago
|
||
I think the problem is that with these changes [1] we use the first item in the regionalPrefsLocales array but with the getLocales wrapper in mozIntl.jsm, we use the full array [2]. I think this makes a difference when we attempt to resolve the locale at [3].
The test that is failing calls localeService.negotiateLanguages [4] to determine the default locale if no locales are specified. I think we need to either change the code in XPCLocale.cpp to also call NegotiateLanguages, or change the test expectations to not do so. I'm guessing we'd want to add the call to NegotiateLanguages in XPCLocale but I'm not completely sure.
Zibi, what do you think?
[1] https://hg.mozilla.org/integration/autoland/rev/05b8c9d0b50d#l1.21
[2] https://searchfox.org/mozilla-central/source/toolkit/components/mozintl/mozIntl.jsm#26
[3] https://searchfox.org/mozilla-central/source/js/src/builtin/intl/IntlObject.js#209
[4] https://searchfox.org/mozilla-central/source/dom/tests/mochitest/chrome/test_intlUtils_getLocaleInfo.html#21
Assignee | ||
Comment 11•5 years ago
|
||
I dug into this a little deeper, and I was completely wrong about the array stuff, I only have one entry on my system anyway.
As far as I can tell, the difference is the call to NegotiateLanguages. On my system, my regionalPrefsLocale is "en-CA" and my availableLocales is "en-US", and we end up using "en-US". Prior to my changes, we used the app locale in XPCLocale, which is also "en-US" and the test passed. With my changes, we now use the regionalPrefsLocale in XPCLocale, which is "en-CA", and the test fails.
Comment 12•5 years ago
|
||
Comment 13•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/ee7bed950965
https://hg.mozilla.org/mozilla-central/rev/36bff8882d55
https://hg.mozilla.org/mozilla-central/rev/fa5240689523
https://hg.mozilla.org/mozilla-central/rev/47eb8c778c41
Description
•