Skip to content

Commit 3b27cf8

Browse files
authored
CLDR-18370 Prevent alt=ascii values from being exported for datetime test data (unicode-org#4646)
1 parent 94fb1a5 commit 3b27cf8

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

common/testData/datetime/datetime.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@
590590
"calendar": "gregorian",
591591
"locale": "en",
592592
"input": "2000-01-01T00:00Z[Etc/GMT]",
593-
"expected": "12:00:00 AM"
593+
"expected": "12:00:00AM"
594594
},
595595
{
596596
"semanticSkeleton": "T",
@@ -599,7 +599,7 @@
599599
"calendar": "gregorian",
600600
"locale": "en",
601601
"input": "2024-07-01T08:50:07Z[Etc/GMT]",
602-
"expected": "8:50:07 AM"
602+
"expected": "8:50:07AM"
603603
},
604604
{
605605
"semanticSkeleton": "T",
@@ -608,7 +608,7 @@
608608
"calendar": "gregorian",
609609
"locale": "en",
610610
"input": "2014-07-15T12:00Z[Etc/GMT]",
611-
"expected": "12:00:00 PM"
611+
"expected": "12:00:00PM"
612612
},
613613
{
614614
"semanticSkeleton": "T",
@@ -618,7 +618,7 @@
618618
"calendar": "gregorian",
619619
"locale": "en",
620620
"input": "2000-01-01T00:00Z[Etc/GMT]",
621-
"expected": "12:00:00 AM"
621+
"expected": "12:00:00AM"
622622
},
623623
{
624624
"semanticSkeleton": "T",
@@ -628,7 +628,7 @@
628628
"calendar": "gregorian",
629629
"locale": "en",
630630
"input": "2024-07-01T08:50:07Z[Etc/GMT]",
631-
"expected": "8:50:07 AM"
631+
"expected": "8:50:07AM"
632632
},
633633
{
634634
"semanticSkeleton": "T",
@@ -638,7 +638,7 @@
638638
"calendar": "gregorian",
639639
"locale": "en",
640640
"input": "2014-07-15T12:00Z[Etc/GMT]",
641-
"expected": "12:00:00 PM"
641+
"expected": "12:00:00PM"
642642
},
643643
{
644644
"semanticSkeleton": "T",
@@ -648,7 +648,7 @@
648648
"calendar": "gregorian",
649649
"locale": "en",
650650
"input": "2000-01-01T00:00Z[Etc/GMT]",
651-
"expected": "12:00:00 AM"
651+
"expected": "12:00:00AM"
652652
},
653653
{
654654
"semanticSkeleton": "T",
@@ -658,7 +658,7 @@
658658
"calendar": "gregorian",
659659
"locale": "en",
660660
"input": "2024-07-01T08:50:07Z[Etc/GMT]",
661-
"expected": "8:50:07 AM"
661+
"expected": "8:50:07AM"
662662
},
663663
{
664664
"semanticSkeleton": "T",
@@ -668,7 +668,7 @@
668668
"calendar": "gregorian",
669669
"locale": "en",
670670
"input": "2014-07-15T12:00Z[Etc/GMT]",
671-
"expected": "12:00:00 PM"
671+
"expected": "12:00:00PM"
672672
},
673673
{
674674
"semanticSkeleton": "T",
@@ -678,7 +678,7 @@
678678
"calendar": "gregorian",
679679
"locale": "en",
680680
"input": "2000-01-01T00:00Z[Etc/GMT]",
681-
"expected": "12:00:00 AM"
681+
"expected": "12:00:00AM"
682682
},
683683
{
684684
"semanticSkeleton": "T",
@@ -688,7 +688,7 @@
688688
"calendar": "gregorian",
689689
"locale": "en",
690690
"input": "2024-07-01T08:50:07Z[Etc/GMT]",
691-
"expected": "8:50:07 AM"
691+
"expected": "8:50:07AM"
692692
},
693693
{
694694
"semanticSkeleton": "T",
@@ -698,7 +698,7 @@
698698
"calendar": "gregorian",
699699
"locale": "en",
700700
"input": "2014-07-15T12:00Z[Etc/GMT]",
701-
"expected": "12:00:00 PM"
701+
"expected": "12:00:00PM"
702702
},
703703
{
704704
"semanticSkeleton": "T",

tools/cldr-code/src/main/java/org/unicode/cldr/util/DateTimeFormats.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ enum MyOptions {
157157
/**
158158
* Set a CLDRFile and calendar. Must be done before calling addTable.
159159
*
160+
* <p>Note: currently, this method will skip `alt="ascii"` elements of `dateFormatItem`. This
161+
* may be configurable in the future. See CLDR-18580
162+
*
160163
* @param file
161164
* @param calendarID
162165
* @return
@@ -168,6 +171,9 @@ public DateTimeFormats set(CLDRFile file, String calendarID) {
168171
/**
169172
* Set a CLDRFile and calendar. Must be done before calling addTable.
170173
*
174+
* <p>Note: currently, this method will skip `alt="ascii"` elements of `dateFormatItem`. This
175+
* may be configurable in the future. See CLDR-18580
176+
*
171177
* @param file
172178
* @param calendarID
173179
* @return
@@ -270,6 +276,10 @@ public DateTimeFormats set(CLDRFile file, String calendarID, boolean useStock) {
270276
+ calendarID
271277
+ "\"]/dateTimeFormats/availableFormats/dateFormatItem"))) {
272278
XPathParts parts = XPathParts.getFrozenInstance(path);
279+
if ("ascii".equals(parts.findAttributeValue("dateFormatItem", "alt"))) {
280+
// TODO(CLDR-18580): Make this configurable.
281+
continue;
282+
}
273283
String key = parts.getAttributeValue(-1, "id");
274284
String value = file.getStringValue(path);
275285
if (key.equals(DEBUG_SKELETON)) {

0 commit comments

Comments
 (0)