Bug 1697729: Re-add alias and parent links in ICU filters. r=tcampbell

The `-/*` filter also removes the alias (`%%ALIAS`) and parent locale (`%%Parent`)
links, so we have to manually add them back when we're using `-/*`.

The ICU docs warn about this issue, but unfortunately that warning wasn't
present when we originally created our filter file, so this bug went unnoticed
for a long time.

Differential Revision: https://phabricator.services.mozilla.com/D116981
This commit is contained in:
André Bargull 2021-06-16 06:49:45 +00:00
Родитель 5e955a47c4
Коммит 3fe14705b6
3 изменённых файлов: 39 добавлений и 0 удалений

Двоичные данные
config/external/icu/data/icudt69l.dat поставляемый

Двоичный файл не отображается.

Просмотреть файл

@ -53,6 +53,8 @@
],
"rules": [
"-/*",
"+/%%ALIAS",
"+/%%Parent",
"+/*/area/acre",
"+/*/digital/bit",
@ -194,6 +196,8 @@
],
"rules": [
"-/*",
"+/%%ALIAS",
"+/%%Parent",
"+/Languages",
"+/Languages%short",
@ -212,6 +216,8 @@
],
"rules": [
"-/*",
"+/%%ALIAS",
"+/%%Parent",
"+/Countries",
"+/Countries%short"

Просмотреть файл

@ -0,0 +1,33 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl'))
// Ensure alias and parent locales are correctly picked up when calling into ICU.
// "zh-HK" is an alias to "zh-Hant-HK", so display names should default to
// traditional instead of simplified characters.
{
const zh_Hant = new Intl.DisplayNames("zh-Hant", {type: "region"});
const zh_Hans = new Intl.DisplayNames("zh-Hans", {type: "region"});
const zh_HK = new Intl.DisplayNames("zh-HK", {type: "region"});
// We assume traditional and simplified have different outputs.
assertEq(zh_Hant.of("US") === zh_Hans.of("US"), false);
// "zh-HK" should use traditional characters.
assertEq(zh_HK.of("US"), zh_Hant.of("US"));
}
// The parent locale of "en-AU" is "en-001" and not "en" (because "en" actually means "en-US").
{
const en = new Intl.DisplayNames("en", {type: "language"});
const en_001 = new Intl.DisplayNames("en-001", {type: "language"});
const en_AU = new Intl.DisplayNames("en-AU", {type: "language"});
// We assume "en" and "en-001" have different outputs.
assertEq(en.of("nds-NL") === en_001.of("nds-NL"), false);
// "en-AU" should have the same output as "en-001".
assertEq(en_AU.of("nds-NL"), en_001.of("nds-NL"));
}
if (typeof reportCompare === "function")
reportCompare(true, true);