Skip to content

Commit 3996a17

Browse files
sffcmacchiati
andauthored
CLDR-19031 Add c12, c24 to hour cycle identifier list (#5103)
Co-authored-by: Mark Davis <[email protected]>
1 parent 208761f commit 3996a17

File tree

5 files changed

+37
-21
lines changed

5 files changed

+37
-21
lines changed

common/bcp47/calendar.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ For terms of use, see http://www.unicode.org/copyright.html
4545
<type name="h23" description="Hour system using 0–23; 'H' in patterns" since="28" />
4646
<type name="h11" description="Hour system using 0–11; 'K' in patterns" since="28" />
4747
<type name="h24" description="Hour system using 1–24; 'k' in patterns" since="28" />
48+
<type name="c12" description="Best 12-hour cycle for locale (h11 or h12)" since="48" deprecated="true" /> <!-- Technical Preview -->
49+
<type name="c24" description="Best 24-hour cycle for locale (h23 or h24)" since="48" deprecated="true" /> <!-- Technical Preview -->
4850
</key>
4951
</keyword>
5052
</ldmlBCP47>

docs/ldml/tr35-dates.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ The calculation of the first day of the week depends on various fields in a loca
12591259

12601260
This element is for data that indicates, for various regions, the preferred time cycle in the region, as well as all time cycles that are considered acceptable in the region. The defaults are those specified for region 001.
12611261

1262-
There is a single `preferred` value, and multiple `allowed` values. The meanings of the values H, h, K, k, b and B are defined in [Date Field Symbol Table](#Date_Field_Symbol_Table). The `allowed` values are in preference order, and are used with the 'C' hour skeleton pattern symbol.
1262+
There is a single `preferred` value, and multiple `allowed` values. The meanings of the values H, h, K, k, b and B are defined in [Date Field Symbol Table](#Date_Field_Symbol_Table). The `allowed` values are in preference order; they are used with the 'C' hour skeleton pattern symbol and the `c12` and `c24` values for the [Unicode Hour Cycle Identifier](tr35.md#UnicodeHourCycleIdentifier).
12631263

12641264
For example, in the following, RU (Russia) is marked as using only 24 hour time, and in particular the 24 hour time that goes from 0..23 (H), rather than from 1..24 (k).
12651265

@@ -2650,8 +2650,10 @@ The choices are:
26502650
3. **H12:** Display hours numbered from 1 through 12 (the most common 12-hour clock)
26512651
4. **H23:** Display hours numbered from 0 through 23 (the most common 24-hour clock)
26522652
5. **H24:** Display hours numbered from 1 through 24
2653+
6. **Clock12:** Display hours using a 12-hour clock preferred by the locale
2654+
7. **Clock24:** Display hours using a 24-hour clock preferred by the locale
26532655

2654-
Typically, locales will display a day period on H11 and H12, but the day period could be any of those allowed by CLDR, such as AM/PM (field "a"), noon/midnight (field "b"), or flexible day periods such as "in the afternoon" (field "B"). The choice could depend on locale, length, and calendar system.
2656+
Typically, locales will display a day period on H11, H12, and Clock12, but the day period could be any of those allowed by CLDR, such as AM/PM (field "a"), noon/midnight (field "b"), or flexible day periods such as "in the afternoon" (field "B"). The choice could depend on locale, length, and calendar system.
26552657

26562658
Note: An option could be added in the future to give the developer more control over how day periods are displayed or to disable day periods when there is sufficient context.
26572659

@@ -2715,23 +2717,23 @@ The following table contains the basic mapping from a semantic field to a standa
27152717
- Standalone: whether the specified field is the only field in the semantic skeleton. "N/A" means to use the same standard field for both standalone and non-standalone.
27162718
- Option: for Time, this is the [hour cycle](#Semantic_Skeleton_Hour_Cycle), and for Zone, this is the [time zone style](#Semantic_Skeleton_Time_Zone_Style).
27172719

2718-
| Semantic Field | Standalone? | Option | Long | Medium | Short |
2719-
|----------------|-------------|----------|--------|--------|--------|
2720-
| Year | N/A | N/A | \* | \* | \* |
2721-
| Month | No | N/A | \* | \* | \* |
2722-
| Month | Yes | N/A | LLLL | LLL | L |
2723-
| Day | N/A | N/A | \* | \* | \* |
2724-
| Weekday | No | N/A | EEEE | EEE | EEE |
2725-
| Weekday | Yes | N/A | EEEE | EEE | EEEEE |
2726-
| Time | N/A | unset | C | C | C |
2727-
| Time | N/A | H11, H12 | h | h | h |
2728-
| Time | N/A | H23, H24 | H | H | H |
2729-
| Zone | No | Generic | v | v | v |
2730-
| Zone | Yes | Generic | vvvv | vvvv | v |
2731-
| Zone | No | Specific | z | z | z |
2732-
| Zone | Yes | Specific | zzzz | zzzz | z |
2733-
| Zone | N/A | Location | VVVV | VVVV | VVVV |
2734-
| Zone | N/A | Offset | O | O | O |
2720+
| Semantic Field | Standalone? | Option | Long | Medium | Short |
2721+
|----------------|-------------|-------------------|--------|--------|--------|
2722+
| Year | N/A | N/A | \* | \* | \* |
2723+
| Month | No | N/A | \* | \* | \* |
2724+
| Month | Yes | N/A | LLLL | LLL | L |
2725+
| Day | N/A | N/A | \* | \* | \* |
2726+
| Weekday | No | N/A | EEEE | EEE | EEE |
2727+
| Weekday | Yes | N/A | EEEE | EEE | EEEEE |
2728+
| Time | N/A | unset | C | C | C |
2729+
| Time | N/A | H11, H12, Clock12 | h | h | h |
2730+
| Time | N/A | H23, H24, Clock24 | H | H | H |
2731+
| Zone | No | Generic | v | v | v |
2732+
| Zone | Yes | Generic | vvvv | vvvv | v |
2733+
| Zone | No | Specific | z | z | z |
2734+
| Zone | Yes | Specific | zzzz | zzzz | z |
2735+
| Zone | N/A | Location | VVVV | VVVV | VVVV |
2736+
| Zone | N/A | Offset | O | O | O |
27352737

27362738
\* Lengths for Year, Month, and Day are taken from the [datetimeSkeleton](#dateFormats) in the Long, Medium, and Short variants. The era field, if present, should be included with the Year. For example, in en-US, CLDR 46, the datetimeSkeletons are:
27372739

docs/ldml/tr35.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,8 +1094,8 @@ The BCP 47 form for keys and types is the canonical form, and recommended. Other
10941094
The valid values are those <i>name</i> attribute values in the <i>type</i> elements of
10951095
key name="hc" in bcp47/<a href="https://github.com/unicode-org/cldr/blob/main/common/bcp47/calendar.xml" target="_blank">calendar.xml</a></b>.
10961096
</td></tr>
1097-
<tr><td rowspan="4"><code>hc</code></td>
1098-
<td rowspan="4">Hour cycle</td>
1097+
<tr><td rowspan="6"><code>hc</code></td>
1098+
<td rowspan="6">Hour cycle</td>
10991099
<td><code>h12</code></td>
11001100
<td>Hour system using 1–12; corresponds to 'h' in patterns</td></tr>
11011101
<tr><td><code>h23</code></td>
@@ -1104,6 +1104,10 @@ The BCP 47 form for keys and types is the canonical form, and recommended. Other
11041104
<td>Hour system using 0–11; corresponds to 'K' in patterns</td></tr>
11051105
<tr><td><code>h24</code></td>
11061106
<td>Hour system using 1–24; corresponds to 'k' in pattern</td></tr>
1107+
<tr><td><code>c12</code></td>
1108+
<td><b>Technical Preview:</b> Locale-preferred 12-hour cycle; resolves to either <tt>h11</tt> or <tt>h12</tt>. First, select the supplemental time data <tt>hours</tt> element according to the <a href="#RegionOverride">Region Override</a>; if that keyword is not present, use the <a href="#unicode_region_subtag">Unicode Region Subtag</a>; if neither is present, or if the region does not have an entry in supplemental time data, use the region 001. Then, iterate through the <tt>allowed</tt> list of hour cycle symbols in preference order. If there is an entry with symbol <tt>K</tt> before an entry with symbol <tt>h</tt>, use <tt>h11</tt>; otherwise, use <tt>h12</tt>.</td></tr>
1109+
<tr><td><code>c24</code></td>
1110+
<td><b>Technical Preview:</b> Locale-preferred 24-hour cycle; resolves to either <tt>h23</tt> or <tt>h24</tt>. First, select the supplemental time data <tt>hours</tt> element as above. Then, iterate through the <tt>allowed</tt> list of hour cycle symbols in preference order. If there is an entry with symbol <tt>k</tt> before an entry with symbol <tt>H</tt>, use <tt>h24</tt>; otherwise, use <tt>h23</tt>.</td></tr>
11071111

11081112
<tr><td colspan="4"><b>A <a name="UnicodeLineBreakStyleIdentifier" id="UnicodeLineBreakStyleIdentifier" href="#UnicodeLineBreakStyleIdentifier">Unicode Line Break Style Identifier</a>
11091113
defines a preferred line break style corresponding to the CSS level 3 <a href="https://drafts.csswg.org/css-text/#line-break-property">line-break option</a>.

docs/site/downloads/cldr-48.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ The definition was unclear, and prone to misunderstanding — the more detailed
164164
#### ldmlBCP47
165165
- `type` — adds a new attribute `region`.
166166
- `keyboard3@conformsTo` — is updated to allow "48".
167+
- `hc` — adds values `c12` and `c24` as Technical Preview. Also see the note about `h24` in "V49 advance warnings". ([CLDR-18894][])
167168

168169
### BCP47 Data Changes
169170

@@ -332,6 +333,7 @@ For web pages with different views of CLDR data, see [http://cldr.unicode.org/in
332333
[CLDR-18219]: https://unicode-org.atlassian.net/browse/CLDR-18219
333334
[CLDR-18275]: https://unicode-org.atlassian.net/browse/CLDR-18275
334335
[CLDR-18311]: https://unicode-org.atlassian.net/browse/CLDR-18311
336+
[CLDR-18894]: https://unicode-org.atlassian.net/browse/CLDR-18894
335337
[CLDR-18956]: https://unicode-org.atlassian.net/browse/CLDR-18956
336338

337339
[Delta DTDs]: https://unicode.org/cldr/charts/48/supplemental/dtd_deltas.html

tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestLocale.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,11 +983,17 @@ public void testLanguageTagParserIsValid() {
983983
"tz",
984984
"aqams|aukns|caffs|camtr|canpg|capnt|cathu|cayzf|cnckg|cnhrb|cnkhg|gaza|mncoq|mxstis|uaozh|uauzh|umjon|usnavajo|est5edt|cst6cdt|mst7mdt|pst8pdt"));
985985

986+
Map<R2<String, String>, String> deprecatedMap = SUPPLEMENTAL_DATA_INFO.getBcp47Deprecated();
987+
986988
for (Entry<String, String> entry :
987989
SUPPLEMENTAL_DATA_INFO.getBcp47Extension2Keys().entrySet()) {
988990
String extension = entry.getKey();
989991
String key = entry.getValue();
992+
990993
for (String value : SUPPLEMENTAL_DATA_INFO.getBcp47Keys().get(key)) {
994+
if ("true".equals(deprecatedMap.get(Row.of(key, value)))) {
995+
continue;
996+
}
991997
String expected = "";
992998
switch (value) {
993999
case "PRIVATE_USE": // x0, valueType="any"

0 commit comments

Comments
 (0)