Update js-display-names.cc

This commit is contained in:
Alexander David Frick 2023-01-25 02:38:33 -06:00 committed by GitHub
parent e4fe865607
commit 2e8d3954ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -133,7 +133,9 @@ class LanguageNames : public LocaleDisplayNamesCommon {
// 1.b If IsStructurallyValidLanguageTag(code) is false, throw a RangeError
// exception.
icu::Locale l =
icu::Locale::createCanonical(icu::Locale::forLanguageTag(code, status).getBaseName());
icu::Locale(icu::Locale::forLanguageTag(code, status).getBaseName());
// 1.c Set code to CanonicalizeUnicodeLocaleId(code).
l.canonicalize(status);
std::string checked = l.toLanguageTag<std::string>(status);
if (U_FAILURE(status)) {