1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:57:45 +00:00

LibJS: Allow specifying keyword values not directly defined for a locale

For example, consider the locales "en-u-nu-fullwide" or "en-u-nu-arab".
The CLDR only declares the "latn" numbering system for the "en" locale,
thus ResolveLocale would change the locale to "en-u-nu-latn". This patch
allows using non-latn numbering systems digits.
This commit is contained in:
Timothy Flynn 2022-07-14 13:55:13 -04:00 committed by Andreas Kling
parent b24b9c0a65
commit aafcdc4c72
6 changed files with 42 additions and 12 deletions

View file

@ -36,12 +36,12 @@ describe("correct behavior", () => {
});
test("numberingSystem option limited to known 'nu' values", () => {
["latn", "arab"].forEach(numberingSystem => {
["latn", "foo"].forEach(numberingSystem => {
const en = new Intl.RelativeTimeFormat("en", { numberingSystem: numberingSystem });
expect(en.resolvedOptions().numberingSystem).toBe("latn");
});
["latn", "arab"].forEach(numberingSystem => {
["latn", "foo"].forEach(numberingSystem => {
const en = new Intl.RelativeTimeFormat(`en-u-nu-${numberingSystem}`);
expect(en.resolvedOptions().numberingSystem).toBe("latn");
});