Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2026 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-Intl.Locale.prototype.getNumberingSystems
description: >
Language subtags with more than three letters are supported.
info: |
NumberingSystemsOfLocale ( loc )
1. If loc.[[NumberingSystem]] is not undefined, then
a. Return CreateArrayFromList(« loc.[[NumberingSystem]] »).
2. Let r be LookupMatchingLocaleByPrefix(%Intl.NumberFormat%.[[AvailableLocales]], « loc.[[Locale]] »).
3. If r is not undefined, then
...
4. Else,
a. Let list be « "latn" ».
5. Return CreateArrayFromList(list).

features: [Intl.Locale, Intl.Locale-info]
---*/

// "abcdefgh" is not a registered language, so it always returns the default
// numbering system "latn".
assert.compareArray(
new Intl.Locale("abcdefgh").getNumberingSystems(),
["latn"],
`with locale "abcdefgh"`
);

// Except if an explicit "nu" Unicode extension subtag is present.
assert.compareArray(
new Intl.Locale("abcdefgh-u-nu-arab").getNumberingSystems(),
["arab"],
`with locale "abcdefgh-u-nu-arab"`
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2026 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-Intl.Locale.prototype.getNumberingSystems
description: >
Matches the resolved numbering system from Intl.NumberFormat using the "lookup" matching.
info: |
NumberingSystemsOfLocale ( loc )
...
2. Let r be LookupMatchingLocaleByPrefix(%Intl.NumberFormat%.[[AvailableLocales]], « loc.[[Locale]] »).
3. If r is not undefined, then
...
4. Else,
a. Let list be « "latn" ».
5. Return CreateArrayFromList(list).

features: [Intl.Locale, Intl.Locale-info]
---*/

const locales = [
"und-BD",
"und-SA",
];

for (let locale of locales) {
// Skip if the locale is (somehow) supported by this implementation.
if (Intl.NumberFormat.supportedLocalesOf(locale, {localeMatcher: "lookup"}).length > 0) {
continue;
}

let numberingSystems = new Intl.Locale(locale).getNumberingSystems();

assert.compareArray(
numberingSystems,
["latn"],
`with locale "${locale}"`
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ description: >
info: |
NumberingSystemsOfLocale ( loc )
...
5. Return ! CreateArrayFromListAndPreferred( list, preferred ).
3. If r is not undefined, then
...
d. Let list be « numberingSystems[0] ».
...
5. Return CreateArrayFromList(list).
features: [Intl.Locale,Intl.Locale-info]
---*/

assert(Array.isArray(new Intl.Locale('en').getNumberingSystems()));
assert(new Intl.Locale('en').getNumberingSystems().length > 0, 'array has at least one element');
var numberingSystems = new Intl.Locale('en').getNumberingSystems();
assert(Array.isArray(numberingSystems));
assert.sameValue(numberingSystems.length, 1, 'array has exactly one element');
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2026 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-intl.locale.prototype.getNumberingSystems
description: >
Returns the preferred numbering systems from the "nu" Unicode extension.
info: |
NumberingSystemsOfLocale ( loc )
1. If loc.[[NumberingSystem]] is not undefined, then
a. Return CreateArrayFromList(« loc.[[NumberingSystem]] »).
...
features: [Intl.Locale, Intl.Locale-info]
---*/

const languages = [
"und",
"en",
];

const extensions = [
"",
"true",
];

for (let language of languages) {
for (let extension of extensions) {
let locale = extension
? `${language}-u-nu-${extension}`
: `${language}-u-nu`;
let loc = new Intl.Locale(locale);
let numberingSystems = loc.getNumberingSystems();

assert.sameValue(
loc.numberingSystem,
"",
`numberingSystem with locale "${locale}"`
);

assert.compareArray(
numberingSystems,
[""],
`numberingSystems with locale "${locale}"`
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright 2026 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-intl.locale.prototype.getNumberingSystems
description: >
Returns the preferred numbering systems from the "nu" Unicode extension.
info: |
NumberingSystemsOfLocale ( loc )
1. If loc.[[NumberingSystem]] is not undefined, then
a. Return CreateArrayFromList(« loc.[[NumberingSystem]] »).
...
features: [Intl.Locale, Intl.Locale-info]
---*/

const languages = [
"und",
"en",
];

const extensions = [
// Empty uvalue.
// "",

// uvalue with a valid numbering system.
"latn",
"arab",
"arabext",
"beng",
"deva",

// uvalue with an invalid numbering system.
"abcdefgh",
"latnlatn",
"latnext",
];

for (let language of languages) {
for (let extension of extensions) {
let locale = extension
? `${language}-u-nu-${extension}`
: `${language}-u-nu`;
let loc = new Intl.Locale(locale)
let numberingSystems = loc.getNumberingSystems();

assert.sameValue(
loc.numberingSystem,
extension,
`numberingSystem with locale "${locale}"`
);

assert.compareArray(
numberingSystems,
[extension],
`numberingSystems with locale "${locale}"`
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright 2026 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-intl.locale.prototype.getNumberingSystems
description: >
Defaults to "latn" if the locale is not supported by Intl.NumberFormat.
info: |
NumberingSystemsOfLocale ( loc )
...
4. Else,
a. Let list be « "latn" ».
5. Return CreateArrayFromList(list).
features: [Intl.Locale, Intl.Locale-info]
---*/

const locales = [
// Undetermined language.
"und",

// Klingon as a sample constructed language.
"tlh",

// "qfz" as a CLDR private use, excluded language subtag.
"qfz",
];

for (let locale of locales) {
// Skip if the locale is (somehow) supported by this implementation.
if (Intl.NumberFormat.supportedLocalesOf(locale).length > 0) {
continue;
}

let numberingSystems = new Intl.Locale(locale).getNumberingSystems();

assert.compareArray(
numberingSystems,
["latn"],
`with locale "${locale}"`
);
}
Loading