Skip to content

Commit 35c32e4

Browse files
committed
Correction of the duplicate variant detection (in transformed extensions).
1 parent c99ae93 commit 35c32e4

File tree

1 file changed

+8
-2
lines changed
  • graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime/util

1 file changed

+8
-2
lines changed

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime/util/IntlUtil.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,14 @@ public static String validateAndCanonicalizeLanguageTag(String languageTag) {
462462
builder.setUnicodeLocaleKeyword(key, type);
463463
}
464464

465-
// Canonicalize transformed extension
466-
String transformedExt = locale.getExtension('t');
465+
// Validate and canonicalize the transformed extension.
466+
// We cannot start with locale.getExtension('t') here. locale is
467+
// canonicalized and ICU started (ICU-21406) to remove duplicate
468+
// variants during canonicalization. Unfortunately, we have
469+
// to detect the duplicates because ECMAScript specification
470+
// refuses such locales as invalid explicitly =>
471+
// we start with a non-canonicalized locale here.
472+
String transformedExt = new ULocale(languageTag).getExtension('t');
467473
if (transformedExt != null) {
468474
builder.setExtension('t', normalizeTransformedExtension(transformedExt));
469475
}

0 commit comments

Comments
 (0)