Skip to content

Commit 8a44678

Browse files
authored
Normative: Take language subtag into account in locale hour cycle and calendar lookup (#1086)
1 parent 5273ed8 commit 8a44678

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

spec/locale.html

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -631,15 +631,17 @@ <h1>
631631
1. If _loc_.[[Calendar]] is not *undefined*, then
632632
1. Return CreateArrayFromList(« _loc_.[[Calendar]] »).
633633
1. Let _preference_ be RegionPreference(_loc_.[[Locale]]).
634-
1. Let _region_ be _preference_.[[Region]].
635-
1. Let _regionOverride_ be _preference_.[[RegionOverride]].
636-
1. If _regionOverride_ is not *undefined* and calendar preference data for _regionOverride_ are available, then
637-
1. Let _lookupRegion_ be _regionOverride_.
638-
1. Else,
639-
1. Let _lookupRegion_ be _region_.
634+
1. If _preference_.[[RegionOverride]] is not *undefined*, let _preferredRegions_ be « _preference_.[[RegionOverride]], _preference_.[[Region]] »; else let _preferredRegions_ be « _preference_.[[Region]] ».
635+
1. Let _calendarsInUse_ be a new empty List.
636+
1. Let _language_ be GetLocaleLanguage(_loc_.[[Locale]]).
637+
1. For each String _region_ of _preferredRegions_, do
638+
1. Let _locale_ be the string-concatenation of _language_, *"-"*, and _region_.
639+
1. If _calendarsInUse_ is empty and calendar preference data for locale _locale_ are available, then
640+
1. Set _calendarsInUse_ to a List of unique calendar types in common use for date and time formatting in locale _locale_, sorted by descending preference of use in _locale_.
641+
1. If _calendarsInUse_ is empty and calendar preference data for region _region_ are available, then
642+
1. Set _calendarsInUse_ to a List of unique calendar types in common use for date and time formatting in region _region_, sorted by descending preference of use in _region_.
640643
1. Let _list_ be a new empty List.
641644
1. Let _availableCalendars_ be AvailableCalendars().
642-
1. Let _calendarsInUse_ be a List of unique calendar types in common use for date and time formatting in _lookupRegion_, sorted by descending preference of use in _lookupRegion_. The list is empty if no calendar preference data for _lookupRegion_ is available.
643645
1. For each element _identifier_ of _calendarsInUse_, do
644646
1. Let _canonical_ be CanonicalizeUValue(*"ca"*, _identifier_).
645647
1. If _availableCalendars_ contains _canonical_ and _list_ does not contain _canonical_, then
@@ -689,15 +691,17 @@ <h1>
689691
1. If _loc_.[[HourCycle]] is not *undefined*, then
690692
1. Return CreateArrayFromList(« _loc_.[[HourCycle]] »).
691693
1. Let _preference_ be RegionPreference(_loc_.[[Locale]]).
692-
1. Let _region_ be _preference_.[[Region]].
693-
1. Let _regionOverride_ be _preference_.[[RegionOverride]].
694-
1. If _regionOverride_ is not *undefined* and time data for _regionOverride_ are available, then
695-
1. Let _lookupRegion_ be _regionOverride_.
696-
1. Else,
697-
1. Let _lookupRegion_ be _region_.
698-
1. Let _list_ be a List of unique hour cycle identifiers, which must be lower case String values indicating either the 12-hour format (*"h11"*, *"h12"*) or the 24-hour format (*"h23"*, *"h24"*), sorted in descending preference of those in common use for date and time formatting in _lookupRegion_. The list is empty if no time data for _lookupRegion_ is available.
699-
1. If _list_ is empty, set _list_ to « *"h23"* ».
700-
1. Return CreateArrayFromList(_list_).
694+
1. If _preference_.[[RegionOverride]] is not *undefined*, let _preferredRegions_ be « _preference_.[[RegionOverride]], _preference_.[[Region]] »; else let _preferredRegions_ be « _preference_.[[Region]] ».
695+
1. Let _hourCycles_ be a new empty List.
696+
1. Let _language_ be GetLocaleLanguage(_loc_.[[Locale]]).
697+
1. For each String _region_ of _preferredRegions_, do
698+
1. Let _locale_ be the string-concatenation of _language_, *"-"*, and _region_.
699+
1. If _hourCycles_ is empty and time data for locale _locale_ are available, then
700+
1. Set _hourCycles_ to a List of unique hour cycle identifiers, which must be lower case Strings indicating either the 12-hour format (*"h11"*, *"h12"*) or the 24-hour format (*"h23"*, *"h24"*), sorted in descending preference of those in common use for date and time formatting in locale _locale_.
701+
1. If _hourCycles_ is empty and time data for region _region_ are available, then
702+
1. Set _hourCycles_ to a List of unique hour cycle identifiers, which must be lower case Strings indicating either the 12-hour format (*"h11"*, *"h12"*) or the 24-hour format (*"h23"*, *"h24"*), sorted in descending preference of those in common use for date and time formatting in region _region_.
703+
1. If _hourCycles_ is empty, set _hourCycles_ to « *"h23"* ».
704+
1. Return CreateArrayFromList(_hourCycles_).
701705
</emu-alg>
702706
</emu-clause>
703707

0 commit comments

Comments
 (0)