diff --git a/spec/collator.html b/spec/collator.html index 24961af9..f63ed9de 100644 --- a/spec/collator.html +++ b/spec/collator.html @@ -45,7 +45,7 @@

InitializeCollator ( _collator_, _locales_, _options_ )

1. Let _localeData_ be %Collator%.[[SearchLocaleData]]. 1. Let _opt_ be a new Record. 1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, ~string~, « *"lookup"*, *"best fit"* », *"best fit"*). - 1. Set _opt_.[[localeMatcher]] to _matcher_. + 1. Set _opt_.[[LocaleMatcher]] to _matcher_. 1. Let _collation_ be ? GetOption(_options_, *"collation"*, ~string~, ~empty~, *undefined*). 1. If _collation_ is not *undefined*, then 1. If _collation_ does not match the Unicode Locale Identifier `type` nonterminal, throw a *RangeError* exception. @@ -58,7 +58,7 @@

InitializeCollator ( _collator_, _locales_, _options_ )

1. Set _opt_.[[kf]] to _caseFirst_. 1. Let _relevantExtensionKeys_ be %Collator%.[[RelevantExtensionKeys]]. 1. Let _r_ be ResolveLocale(%Collator%.[[AvailableLocales]], _requestedLocales_, _opt_, _relevantExtensionKeys_, _localeData_). - 1. Set _collator_.[[Locale]] to _r_.[[locale]]. + 1. Set _collator_.[[Locale]] to _r_.[[Locale]]. 1. Let _collation_ be _r_.[[co]]. 1. If _collation_ is *null*, let _collation_ be *"default"*. 1. Set _collator_.[[Collation]] to _collation_. @@ -71,9 +71,9 @@

InitializeCollator ( _collator_, _locales_, _options_ )

1. If _usage_ is *"sort"*, then 1. Let _sensitivity_ be *"variant"*. 1. Else, - 1. Let _dataLocale_ be _r_.[[dataLocale]]. + 1. Let _dataLocale_ be _r_.[[DataLocale]]. 1. Let _dataLocaleData_ be _localeData_.[[<_dataLocale_>]]. - 1. Let _sensitivity_ be _dataLocaleData_.[[sensitivity]]. + 1. Let _sensitivity_ be _dataLocaleData_.[[Sensitivity]]. 1. Set _collator_.[[Sensitivity]] to _sensitivity_. 1. Let _ignorePunctuation_ be ? GetOption(_options_, *"ignorePunctuation"*, ~boolean~, ~empty~, *false*). 1. Set _collator_.[[IgnorePunctuation]] to _ignorePunctuation_. @@ -133,7 +133,7 @@

Internal slots

diff --git a/spec/datetimeformat.html b/spec/datetimeformat.html index ce2b4aa6..634256aa 100644 --- a/spec/datetimeformat.html +++ b/spec/datetimeformat.html @@ -54,7 +54,7 @@

InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )

1. Set _options_ to ? ToDateTimeOptions(_options_, *"any"*, *"date"*). 1. Let _opt_ be a new Record. 1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, ~string~, « *"lookup"*, *"best fit"* », *"best fit"*). - 1. Set _opt_.[[localeMatcher]] to _matcher_. + 1. Set _opt_.[[LocaleMatcher]] to _matcher_. 1. Let _calendar_ be ? GetOption(_options_, *"calendar"*, ~string~, ~empty~, *undefined*). 1. If _calendar_ is not *undefined*, then 1. If _calendar_ does not match the Unicode Locale Identifier `type` nonterminal, throw a *RangeError* exception. @@ -70,13 +70,13 @@

InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )

1. Set _opt_.[[hc]] to _hourCycle_. 1. Let _localeData_ be %DateTimeFormat%.[[LocaleData]]. 1. Let _r_ be ResolveLocale(%DateTimeFormat%.[[AvailableLocales]], _requestedLocales_, _opt_, %DateTimeFormat%.[[RelevantExtensionKeys]], _localeData_). - 1. Set _dateTimeFormat_.[[Locale]] to _r_.[[locale]]. + 1. Set _dateTimeFormat_.[[Locale]] to _r_.[[Locale]]. 1. Let _resolvedCalendar_ be _r_.[[ca]]. 1. Set _dateTimeFormat_.[[Calendar]] to _resolvedCalendar_. 1. Set _dateTimeFormat_.[[NumberingSystem]] to _r_.[[nu]]. - 1. Let _dataLocale_ be _r_.[[dataLocale]]. + 1. Let _dataLocale_ be _r_.[[DataLocale]]. 1. Let _dataLocaleData_ be _localeData_.[[<_dataLocale_>]]. - 1. Let _hcDefault_ be _dataLocaleData_.[[hourCycle]]. + 1. Let _hcDefault_ be _dataLocaleData_.[[HourCycle]]. 1. If _hour12_ is *true*, then 1. If _hcDefault_ is *"h11"* or *"h23"*, let _hc_ be *"h11"*. Otherwise, let _hc_ be *"h12"*. 1. Else if _hour12_ is *false*, then @@ -96,7 +96,7 @@

InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )

1. Set _timeZone_ to CanonicalizeTimeZoneName(_timeZone_). 1. Set _dateTimeFormat_.[[TimeZone]] to _timeZone_. 1. Let _formatOptions_ be a new Record. - 1. Set _formatOptions_.[[hourCycle]] to _hc_. + 1. Set _formatOptions_.[[HourCycle]] to _hc_. 1. Let _hasExplicitFormatComponents_ be *false*. 1. For each row of , except the header row, in table order, do 1. Let _prop_ be the name given in the Property column of the row. @@ -105,7 +105,10 @@

InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )

1. Else, 1. Let _values_ be a List whose elements are the strings given in the Values column of the row. 1. Let _value_ be ? GetOption(_options_, _prop_, ~string~, _values_, *undefined*). - 1. Set _formatOptions_.[[<_prop_>]] to _value_. + 1. Let _first_ be the ASCII-uppercase of the substring of _prop_ from 0 to 1. + 1. Let _rest_ be the substring of prop from 1. + 1. Let _field_ be the string-concatenation of _first_ and _rest_. + 1. Set _formatOptions_.[[<_field_>]] to _value_. 1. If _value_ is not *undefined*, then 1. Set _hasExplicitFormatComponents_ to *true*. 1. Let _matcher_ be ? GetOption(_options_, *"formatMatcher"*, ~string~, « *"basic"*, *"best fit"* », *"best fit"*). @@ -116,27 +119,30 @@

InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )

1. If _dateStyle_ is not *undefined* or _timeStyle_ is not *undefined*, then 1. If _hasExplicitFormatComponents_ is *true*, then 1. Throw a *TypeError* exception. - 1. Let _styles_ be _dataLocaleData_.[[styles]].[[<_resolvedCalendar_>]]. + 1. Let _styles_ be _dataLocaleData_.[[Styles]].[[<_resolvedCalendar_>]]. 1. Let _bestFormat_ be DateTimeStyleFormat(_dateStyle_, _timeStyle_, _styles_). 1. Else, - 1. Let _formats_ be _dataLocaleData_.[[formats]].[[<_resolvedCalendar_>]]. + 1. Let _formats_ be _dataLocaleData_.[[Formats]].[[<_resolvedCalendar_>]]. 1. If _matcher_ is *"basic"*, then 1. Let _bestFormat_ be BasicFormatMatcher(_formatOptions_, _formats_). 1. Else, 1. Let _bestFormat_ be BestFitFormatMatcher(_formatOptions_, _formats_). 1. For each row in , except the header row, in table order, do 1. Let _prop_ be the name given in the Property column of the row. - 1. If _bestFormat_ has a field [[<_prop_>]], then - 1. Let _p_ be _bestFormat_.[[<_prop_>]]. + 1. Let _first_ be the ASCII-uppercase of the substring of _prop_ from 0 to 1. + 1. Let _rest_ be the substring of prop from 1. + 1. Let _field_ be the string-concatenation of _first_ and _rest_. + 1. If _bestFormat_ has a field [[<_field_>]], then + 1. Let _p_ be _bestFormat_.[[<_field_>]]. 1. Set _dateTimeFormat_'s internal slot whose name is the Internal Slot column of the row to _p_. 1. If _dateTimeFormat_.[[Hour]] is *undefined*, then 1. Set _dateTimeFormat_.[[HourCycle]] to *undefined*. 1. If _dateTimeFormat_.[[HourCycle]] is *"h11"* or *"h12"*, then - 1. Let _pattern_ be _bestFormat_.[[pattern12]]. - 1. Let _rangePatterns_ be _bestFormat_.[[rangePatterns12]]. + 1. Let _pattern_ be _bestFormat_.[[Pattern12]]. + 1. Let _rangePatterns_ be _bestFormat_.[[RangePatterns12]]. 1. Else, - 1. Let _pattern_ be _bestFormat_.[[pattern]]. - 1. Let _rangePatterns_ be _bestFormat_.[[rangePatterns]]. + 1. Let _pattern_ be _bestFormat_.[[Pattern]]. + 1. Let _rangePatterns_ be _bestFormat_.[[RangePatterns]]. 1. Set _dateTimeFormat_.[[Pattern]] to _pattern_. 1. Set _dateTimeFormat_.[[RangePatterns]] to _rangePatterns_. 1. Return _dateTimeFormat_. @@ -203,33 +209,33 @@

Internal slots

[[LocaleData]].[[<_locale_>]].[[hc]] must be « *null*, *"h11"*, *"h12"*, *"h23"*, *"h24"* ».
  • - [[LocaleData]].[[<_locale_>]].[[hourCycle]] must be a String value equal to *"h11"*, *"h12"*, *"h23"*, or *"h24"*. + [[LocaleData]].[[<_locale_>]].[[HourCycle]] must be a String value equal to *"h11"*, *"h12"*, *"h23"*, or *"h24"*.
  • - [[LocaleData]].[[<_locale_>]] must have a [[formats]] field. This [[formats]] field must be a Record with [[<_calendar_>]] fields for all calendar values _calendar_. The value of this field must be a list of records, each of which has a subset of the fields shown in , where each field must have one of the values specified for the field in . Multiple records in a list may use the same subset of the fields as long as they have different values for the fields. The following subsets must be available for each locale: + [[LocaleData]].[[<_locale_>]] must have a [[Formats]] field. This [[Formats]] field must be a Record with [[<_calendar_>]] fields for all calendar values _calendar_. The value of this field must be a list of records, each of which has a subset of the fields shown in the Internal slot/Field column of , where each field must have one of the values specified for the field in . Multiple records in a list may use the same subset of the fields as long as they have different values for the fields. The following subsets must be available for each locale: Each of the records must also have the following fields:
      -
    1. A [[pattern]] field, whose value is a String value that contains for each of the date and time format component fields of the record a substring starting with *"{"*, followed by the name of the field, followed by *"}"*.
    2. -
    3. If the record has an [[hour]] field, it must also have a [[pattern12]] field, whose value is a String value that, in addition to the substrings of the [[pattern]] field, contains at least one of the substrings *"{ampm}"* or *"{dayPeriod}"*.
    4. -
    5. If the record has a [[year]] field, the [[pattern]] and [[pattern12]] values may contain the substrings *"{yearName}"* and *"{relatedYear}"*.
    6. +
    7. A [[Pattern]] field, whose value is a String value that contains for each of the date and time format component fields of the record a substring starting with *"{"*, followed by the name of the field, followed by *"}"*.
    8. +
    9. If the record has an [[Hour]] field, it must also have a [[Pattern12]] field, whose value is a String value that, in addition to the substrings of the [[Pattern]] field, contains at least one of the substrings *"{ampm}"* or *"{dayPeriod}"*.
    10. +
    11. If the record has a [[Year]] field, the [[Pattern]] and [[Pattern12]] values may contain the substrings *"{yearName}"* and *"{relatedYear}"*.
    12. - A [[rangePatterns]] field with a Record value: + A [[RangePatterns]] field with a Record value:
        -
      • The [[rangePatterns]] record may have any of the fields in , where each field represents a range pattern and its value is a Record. +
      • The [[RangePatterns]] record may have any of the fields in , where each field represents a range pattern and its value is a Record.
        • The name of the field indicates the largest calendar element that must be different between the start and end dates in order to use this range pattern. For example, if the field name is [[Month]], it contains the range pattern that should be used to format a date range where the era and year values are the same, but the month value is different.
        • The record will contain the following fields:
        • @@ -239,37 +245,37 @@

          Internal slots

    13. -
    14. The [[rangePatterns]] record must have a [[Default]] field which contains the default range pattern used when the specific range pattern is not available. Its value is a list of records with the same structure as the other fields in the [[rangePatterns]] record.
    15. +
    16. The [[RangePatterns]] record must have a [[Default]] field which contains the default range pattern used when the specific range pattern is not available. Its value is a list of records with the same structure as the other fields in the [[RangePatterns]] record.
    17. -
    18. If the record has an [[hour]] field, it must also have a [[rangePatterns12]] field. Its value is similar to the Record in [[rangePatterns]], but it uses a String similar to [[pattern12]] for each part of the range pattern.
    19. -
    20. If the record has a [[year]] field, the [[rangePatterns]] and [[rangePatterns12]] fields may contain range patterns where the [[Pattern]] values may contain the substrings *"{yearName}"* and *"{relatedYear}"*.
    21. +
    22. If the record has an [[Hour]] field, it must also have a [[RangePatterns12]] field. Its value is similar to the Record in [[RangePatterns]], but it uses a String similar to [[Pattern12]] for each part of the range pattern.
    23. +
    24. If the record has a [[Year]] field, the [[RangePatterns]] and [[RangePatterns12]] fields may contain range patterns where the [[Pattern]] values may contain the substrings *"{yearName}"* and *"{relatedYear}"*.
  • - [[LocaleData]].[[<_locale_>]] must have a [[styles]] field. The [[styles]] field must be a Record with [[<_calendar_>]] fields for all calendar values _calendar_. The calendar records must contain [[DateFormat]], [[TimeFormat]], [[DateTimeFormat]] and [[DateTimeRangeFormat]] fields, the value of these fields are Records, where each of which has [[full]], [[long]], [[medium]] and [[short]] fields. For [[DateFormat]] and [[TimeFormat]], the value of these fields must be a record, which has a subset of the fields shown in , where each field must have one of the values specified for the field in . Each of the records must also have the following fields: + [[LocaleData]].[[<_locale_>]] must have a [[Styles]] field. The [[Styles]] field must be a Record with [[<_calendar_>]] fields for all calendar values _calendar_. The calendar records must contain [[DateFormat]], [[TimeFormat]], [[DateTimeFormat]] and [[DateTimeRangeFormat]] fields, the value of these fields are Records, where each of which has [[Full]], [[Long]], [[Medium]] and [[Short]] fields. For [[DateFormat]] and [[TimeFormat]], the value of these fields must be a record, which has a subset of the fields shown in , where each field must have one of the values specified for the field in . Each of the records must also have the following fields:
      -
    1. A [[pattern]] field, whose value is a String value that contains for each of the date and time format component fields of the record a substring starting with *"{"*, followed by the name of the field, followed by *"}"*.
    2. -
    3. If the record has an [[hour]] field, it must also have a [[pattern12]] field, whose value is a String value that, in addition to the substrings of the pattern field, contains at least one of the substrings *"{ampm}"* or *"{dayPeriod}"*.
    4. -
    5. A [[rangePatterns]] field that contains a record similar to the one described in the [[formats]] field.
    6. -
    7. If the record has an [[hour]] field, it must also have a [[rangePatterns12]] field. Its value is similar to the record in [[rangePatterns]] but it uses a string similar to [[pattern12]] for each range pattern.
    8. +
    9. A [[Pattern]] field, whose value is a String value that contains for each of the date and time format component fields of the record a substring starting with *"{"*, followed by the name of the field, followed by *"}"*.
    10. +
    11. If the record has an [[Hour]] field, it must also have a [[Pattern12]] field, whose value is a String value that, in addition to the substrings of the pattern field, contains at least one of the substrings *"{ampm}"* or *"{dayPeriod}"*.
    12. +
    13. A [[RangePatterns]] field that contains a record similar to the one described in the [[Formats]] field.
    14. +
    15. If the record has an [[Hour]] field, it must also have a [[RangePatterns12]] field. Its value is similar to the record in [[RangePatterns]] but it uses a string similar to [[Pattern12]] for each range pattern.
    - For [[DateTimeFormat]], the field value must be a string pattern which contains the strings *"{0}"* and *"{1}"*. For [[DateTimeRangeFormat]] the value of these fields must be a nested record which also has [[full]], [[long]], [[medium]] and [[short]] fields. The [[full]], [[long]], [[medium]] and [[short]] fields in the enclosing record refer to the date style of the range pattern, while the fields in the nested record refers to the time style of the range pattern. The value of these fields in the nested record is a record with a [[rangePatterns]] field and a [[rangePatterns12]] field which are similar to the [[rangePatterns]] and [rangePatterns12]] fields in [[DateFormat]] and [[TimeFormat]]. + For [[DateTimeFormat]], the field value must be a string pattern which contains the strings *"{0}"* and *"{1}"*. For [[DateTimeRangeFormat]] the value of these fields must be a nested record which also has [[Full]], [[Long]], [[Medium]] and [[Short]] fields. The [[Full]], [[Long]], [[Medium]] and [[Short]] fields in the enclosing record refer to the date style of the range pattern, while the fields in the nested record refers to the time style of the range pattern. The value of these fields in the nested record is a record with a [[RangePatterns]] field and a [[RangePatterns12]] field which are similar to the [[RangePatterns]] and [[RangePatterns12]] fields in [[DateFormat]] and [[TimeFormat]].
  • For example, an implementation might include the following record as part of its English locale data: