From f9036b1a8564ab2c5fd76023384644f2a0156581 Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Wed, 8 Jul 2020 18:25:46 -0700 Subject: [PATCH] Check code also match IsStructurallyValidLanguageTag --- biblio.json | 5 +++++ index.html | 4 ++-- spec.emu | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/biblio.json b/biblio.json index 68107ef..7811f6e 100644 --- a/biblio.json +++ b/biblio.json @@ -25,6 +25,11 @@ "aoid": "CanonicalizeUnicodeLocaleId", "id": "sec-canonicalizeunicodelocaleid" }, + { + "type": "op", + "aoid": "IsStructurallyValidLanguageTag", + "id": "sec-isstructurallyvalidlanguagetag" + }, { "type": "op", "aoid": "SupportedLocales", diff --git a/index.html b/index.html index c916edd..3f4fad9 100644 --- a/index.html +++ b/index.html @@ -1805,7 +1805,7 @@ display: none; } } -

Stage 3 Draft / June 19, 2020

Intl.DisplayNames Proposal

+

Stage 3 Draft / July 9, 2020

Intl.DisplayNames Proposal

1DisplayNames Objects

@@ -1878,7 +1878,7 @@

1.1.1CanonicalCodeForDisplayNames ( typetype, and code. It verifies that the code argument represents a well-formed code according to the type argument and returns the case-regularized form of the code. The algorithm refers to UTS 35's Unicode Language and Locale Identifiers grammar. The following steps are taken:

-
  1. If type is "language", then
    1. If code does not matches the unicode_language_id production, throw a RangeError exceptipon.
    2. Set code to CanonicalizeUnicodeLocaleId(code).
    3. Return code.
  2. If type is "region", then
    1. If code does not matches the unicode_region_subtag production, throw a RangeError exceptipon.
    2. Let code be the result of mapping code to upper case as described in 6.1.
    3. Return code.
  3. If type is "script", then
    1. If code does not matches the unicode_script_subtag production, throw a RangeError exceptipon.
    2. Let code be the result of mapping the first character in code to upper case, and mapping the second, third and fourth character in code to lower case, as described in 6.1.
    3. Return code.
  4. Assert: type is "currency"
  5. If ! IsWellFormedCurrencyCode(code) is false, throw a RangeError exceptipon.
  6. Let code be the result of mapping code to upper case as described in 6.1.
  7. Return code. +
    1. If type is "language", then
      1. If code does not matches the unicode_language_id production, throw a RangeError exceptipon.
      2. If IsStructurallyValidLanguageTag(code) is false, throw a RangeError exception.
      3. Set code to CanonicalizeUnicodeLocaleId(code).
      4. Return code.
    2. If type is "region", then
      1. If code does not matches the unicode_region_subtag production, throw a RangeError exceptipon.
      2. Let code be the result of mapping code to upper case as described in 6.1.
      3. Return code.
    3. If type is "script", then
      1. If code does not matches the unicode_script_subtag production, throw a RangeError exceptipon.
      2. Let code be the result of mapping the first character in code to upper case, and mapping the second, third and fourth character in code to lower case, as described in 6.1.
      3. Return code.
    4. Assert: type is "currency"
    5. If ! IsWellFormedCurrencyCode(code) is false, throw a RangeError exceptipon.
    6. Let code be the result of mapping code to upper case as described in 6.1.
    7. Return code.
    diff --git a/spec.emu b/spec.emu index 0e8d387..448996f 100644 --- a/spec.emu +++ b/spec.emu @@ -71,6 +71,7 @@ contributors: Google, Ecma International 1. If _type_ is `"language"`, then 1. If _code_ does not matches the `unicode_language_id` production, throw a *RangeError* exceptipon. + 1. If IsStructurallyValidLanguageTag(_code_) is *false*, throw a *RangeError* exception. 1. Set _code_ to CanonicalizeUnicodeLocaleId(_code_). 1. Return _code_. 1. If _type_ is `"region"`, then