ICU-21259 Adds a filter to pseudolocale generator to switch a particular
datetime pattern item from 12 hrs to 24 hrs format to prevent a unit
test failure.
ICU-21259 Disables pseudolocale generation in ICU data generation script.
Should not have stayed enabled in the earlier commit.
ICU-21259 Fix indents.
ICU-21259 Modify changes according to review feedback.
diff --git a/tools/cldr/cldr-to-icu/src/main/java/org/unicode/icu/tool/cldrtoicu/PseudoLocales.java b/tools/cldr/cldr-to-icu/src/main/java/org/unicode/icu/tool/cldrtoicu/PseudoLocales.java
index ab7d2e1..886c014 100644
--- a/tools/cldr/cldr-to-icu/src/main/java/org/unicode/icu/tool/cldrtoicu/PseudoLocales.java
+++ b/tools/cldr/cldr-to-icu/src/main/java/org/unicode/icu/tool/cldrtoicu/PseudoLocales.java
@@ -190,6 +190,9 @@
private static final PathMatcher NUMBERING_SYSTEM =
ldml("numbers/defaultNumberingSystem");
+ private static final PathMatcher GREGORIAN_SHORT_STANDARD_PATTERN =
+ ldml("dates/calendars/calendar[@type=\"gregorian\"]/timeFormats/timeFormatLength[@type=\"short\"]/timeFormat[@type=\"standard\"]/pattern[@type=\"standard\"]");
+
// These paths were mostly derived from looking at the previous implementation's behaviour
// and can be modified as needed.
private static final Predicate<CldrPath> IS_PSEUDO_PATH =
@@ -283,7 +286,15 @@
if (IS_NARROW.test(fullPath)) {
return defaultReturnValue;
}
+ // Explicitly return 24 hrs format pattern for the Gregorian short standard pattern
+ // entry to be consistent with the time cycle specified in supplemental.xml for
+ // region 001. 001 is the region the pseudolocales en_XA/ar_XB default to.
+ // This prevents ICU unit test failure.
+ if (GREGORIAN_SHORT_STANDARD_PATTERN.matches(path)) {
+ return CldrValue.parseValue(fullPath, "[H:mm]");
+ }
String text = createMessage(value.getValue(), IS_PATTERN_PATH.test(path));
+
return CldrValue.parseValue(fullPath, text);
}