From: gnrunge Date: Tue, 22 Sep 2020 19:32:26 +0000 (-0700) Subject: ICU-21259 Adds a filter to pseudolocale generator to switch a particular X-Git-Tag: cldr/2020-09-22~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9f388a34f976cc75837ef4911fcc50b513f286c3;p=icu 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 ab7d2e1006b..886c014e450 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 @@ public final class PseudoLocales { 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 IS_PSEUDO_PATH = @@ -283,7 +286,15 @@ public final class PseudoLocales { 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); }