From ffef7c7866cd7eef8d8fbc137ca0b80cd1360d37 Mon Sep 17 00:00:00 2001 From: Emiyare Ikwut-Ukwa <138727724+e-ikwut@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:40:50 +0000 Subject: [PATCH] CLDR-15698 Time examples < 10 and > 12 See #3895 --- .../unicode/cldr/test/ExampleGenerator.java | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/ExampleGenerator.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/ExampleGenerator.java index a83dad880e8..cf9fe9e64c8 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/ExampleGenerator.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/ExampleGenerator.java @@ -48,6 +48,7 @@ import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.unicode.cldr.tool.LikelySubtags; import org.unicode.cldr.util.AnnotationUtil; import org.unicode.cldr.util.CLDRConfig; @@ -92,6 +93,36 @@ import org.unicode.cldr.util.personname.PersonNameFormatter.NamePattern; import org.unicode.cldr.util.personname.SimpleNameObject; +import com.google.common.base.Joiner; +import com.google.common.collect.ImmutableList; +import com.ibm.icu.impl.Row.R3; +import com.ibm.icu.impl.Utility; +import com.ibm.icu.impl.number.DecimalQuantity; +import com.ibm.icu.impl.number.DecimalQuantity_DualStorageBCD; +import com.ibm.icu.lang.UCharacter; +import com.ibm.icu.text.BreakIterator; +import com.ibm.icu.text.DateFormat; +import com.ibm.icu.text.DateFormatSymbols; +import com.ibm.icu.text.DateTimePatternGenerator; +import com.ibm.icu.text.DecimalFormat; +import com.ibm.icu.text.DecimalFormatSymbols; +import com.ibm.icu.text.ListFormatter; +import com.ibm.icu.text.MessageFormat; +import com.ibm.icu.text.NumberFormat; +import com.ibm.icu.text.PluralRules; +import com.ibm.icu.text.PluralRules.DecimalQuantitySamples; +import com.ibm.icu.text.PluralRules.DecimalQuantitySamplesRange; +import com.ibm.icu.text.PluralRules.Operand; +import com.ibm.icu.text.PluralRules.SampleType; +import com.ibm.icu.text.SimpleDateFormat; +import com.ibm.icu.text.SimpleFormatter; +import com.ibm.icu.text.UTF16; +import com.ibm.icu.text.UnicodeSet; +import com.ibm.icu.util.Calendar; +import com.ibm.icu.util.Output; +import com.ibm.icu.util.TimeZone; +import com.ibm.icu.util.ULocale; + /** * Class to generate examples and help messages for the Survey tool (or console version). * @@ -169,6 +200,9 @@ public class ExampleGenerator { private static final Date DATE_SAMPLE2; private static final Date DATE_SAMPLE3; + private static final Date DATE_SAMPLE4; + private static final Date DATE_SAMPLE5; + static { Calendar calendar = Calendar.getInstance(ZONE_SAMPLE, ULocale.ENGLISH); @@ -179,6 +213,11 @@ public class ExampleGenerator { DATE_SAMPLE2 = calendar.getTime(); calendar.set(1999, 8, 5, 7, 0, 0); // 1999-09-05 07:00:00 DATE_SAMPLE3 = calendar.getTime(); + calendar.set(1999, 8, 5, 23, 0, 0); // 1999-09-05 23:00:00 + DATE_SAMPLE4 = calendar.getTime(); + + calendar.set(1999, 8, 5, 3, 25, 59); // 1999-09-05 03:25:59 + DATE_SAMPLE5 = calendar.getTime(); } static final List CURRENCY_SAMPLES = @@ -2670,7 +2709,12 @@ private String handleDateFormatItem(String xpath, String value, boolean showCont + contextheader + exampleEndSymbol : ""; - example = addExampleResult(sdf.format(DATE_SAMPLE), example, showContexts); + String sup_twelve_example = sdf.format(DATE_SAMPLE); + String sub_ten_example = sdf.format(DATE_SAMPLE5); + example = addExampleResult(sup_twelve_example, example, showContexts); + if (!sup_twelve_example.equals(sub_ten_example)) { + example = addExampleResult(sub_ten_example, example, showContexts); + } return example; } } else {