Skip to content

Node and PluralRules: use supported locales in place of obsolete locales#380

Merged
sven-oly merged 1 commit intounicode-org:mainfrom
sven-oly:node_js_locale_fallback
Jan 8, 2025
Merged

Node and PluralRules: use supported locales in place of obsolete locales#380
sven-oly merged 1 commit intounicode-org:mainfrom
sven-oly:node_js_locale_fallback

Conversation

@sven-oly
Copy link
Collaborator

@sven-oly sven-oly commented Jan 8, 2025

#379

Note that this PR changes Node failing tests from 77 to 87, but reduces "unsupported" from 432 to 216, the same as the other platforms.

Comment on lines 48 to +58
try {
const supported_locales =
Intl.PluralRules.supportedLocalesOf(locale, test_options);

if (!supported_locales.includes(locale)) {

return {"label": label,
"error" : "unusupported",
"unsupported": "unsupported_locale",
"error_detail": {'unsupported_locale': locale,
'supported_locals': supported_locales,
'test_options': test_options
}
};
if (supported_locales.includes(locale)) {
actual_locale = locale;
} else {
if (supported_locales) {
actual_locale = supported_locales[0];
}
if (actual_locale == undefined) {
// No, there's no good substitute.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is more complex than it needs to be, but I believe it is technically correct.

@sven-oly sven-oly merged commit 46539fc into unicode-org:main Jan 8, 2025
7 checks passed
@sven-oly sven-oly deleted the node_js_locale_fallback branch January 8, 2025 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants