diff --git a/tools/cldr-code/pom.xml b/tools/cldr-code/pom.xml index 361f456f889..d58ede1ea3d 100644 --- a/tools/cldr-code/pom.xml +++ b/tools/cldr-code/pom.xml @@ -62,6 +62,12 @@ com.vdurmont semver4j + + + + org.pcollections + pcollections + diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDateTimeTestData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDateTimeTestData.java new file mode 100644 index 00000000000..9b19da5669a --- /dev/null +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDateTimeTestData.java @@ -0,0 +1,104 @@ +package org.unicode.cldr.tool; + +import java.io.IOException; +import java.util.Arrays; +import org.pcollections.HashPMap; +import org.pcollections.HashTreePMap; +import org.pcollections.PMap; +import org.pcollections.PVector; +import org.pcollections.TreePVector; +import org.unicode.cldr.util.CLDRPaths; +import org.unicode.cldr.util.TempPrintWriter; + +public class GenerateDateTimeTestData { + + private static final String OUTPUT_SUBDIR = "datetime"; + + private static final String OUTPUT_FILENAME = "datetime.txt"; + + private static final PVector NUMBERING_SYSTEMS = + TreePVector.from(Arrays.asList("latn", "arab", "beng")); + + private static final PVector LOCALES = + TreePVector.from(Arrays.asList("en-US", "en-GB", + "zh-TW", "vi", "ar", "mt-MT", + "bn", "zu", + "und")); + + private static final HashPMap emptyMapStringToObject = HashTreePMap.empty(); + + private static final PVector> SPEC_OPTIONS = + TreePVector.from(Arrays.asList( + emptyMapStringToObject.plus("dateStyle", "short").plus("timeStyle", "short"), + emptyMapStringToObject.plus("dateStyle", "medium").plus("timeStyle", "medium"), + emptyMapStringToObject.plus("dateStyle", "long").plus("timeStyle", "long"), + emptyMapStringToObject.plus("dateStyle", "full").plus("timeStyle", "full"), + emptyMapStringToObject.plus("dateStyle", "full").plus("timeStyle", "short"), + emptyMapStringToObject.plus("dateStyle", "long"), + emptyMapStringToObject.plus("timeStyle", "long"), + emptyMapStringToObject.plus("hour", "numeric"), + emptyMapStringToObject.plus("hour", "numeric").plus("minute", "numeric"), + emptyMapStringToObject.plus("hour", "numeric").plus("minute", "numeric") + .plus("second", "numeric"), + emptyMapStringToObject.plus("hour", "numeric").plus("minute", "numeric") + .plus("second", "numeric").plus("fractionalSecondDigits", 1), + emptyMapStringToObject.plus("hour", "numeric").plus("minute", "numeric") + .plus("second", "numeric").plus("fractionalSecondDigits", 2), + emptyMapStringToObject.plus("hour", "numeric").plus("minute", "numeric") + .plus("second", "numeric").plus("fractionalSecondDigits", 3), + emptyMapStringToObject.plus("hour", "numeric").plus("minute", "numeric") + .plus("second", "numeric"), + emptyMapStringToObject.plus("month", "numeric").plus("weekday", "long") + .plus("day", "numeric"), + emptyMapStringToObject.plus("month", "2-digit").plus("weekday", "long") + .plus("day", "numeric"), + emptyMapStringToObject.plus("month", "long").plus("weekday", "long").plus("day", "numeric"), + emptyMapStringToObject.plus("month", "short").plus("weekday", "long") + .plus("day", "numeric"), + emptyMapStringToObject.plus("month", "narrow").plus("weekday", "long") + .plus("day", "numeric"), + emptyMapStringToObject.plus("month", "short").plus("weekday", "short") + .plus("day", "numeric"), + emptyMapStringToObject.plus("month", "short").plus("weekday", "narrow") + .plus("day", "numeric"), + emptyMapStringToObject.plus("era", "long"), + emptyMapStringToObject.plus("era", "short"), + emptyMapStringToObject.plus("era", "narrow"), + emptyMapStringToObject.plus("timeZoneName", "long"), + emptyMapStringToObject.plus("timeZoneName", "short"), + emptyMapStringToObject.plus("timeZoneName", "shortOffset"), + emptyMapStringToObject.plus("timeZoneName", "longOffset"), + emptyMapStringToObject.plus("timeZoneName", "shortGeneric"), + emptyMapStringToObject.plus("timeZoneName", "longGeneric") + )); + + private static final PVector CALENDARS = + TreePVector.from(Arrays.asList( + "gregory", + "buddhist", "hebrew", "chinese", "roc", "japanese", + "islamic", "islamic-umalqura", "persian" + )); + + private static final PVector TIME_ZONES = + TreePVector.from(Arrays.asList( + "America/Los_Angeles", + "Africa/Luanda", + "Asia/Tehran", + "Europe/Kiev", + "Australia/Brisbane", + "Pacific/Palau", + "America/Montevideo" + )); + + + public static void main(String[] args) throws IOException { + try (TempPrintWriter pw = + TempPrintWriter.openUTF8Writer( + CLDRPaths.TEST_DATA + OUTPUT_SUBDIR, OUTPUT_FILENAME)) { + + + + } + } + +} diff --git a/tools/pom.xml b/tools/pom.xml index 7f629fa02a8..6e3b84ec79f 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -190,6 +190,13 @@ semver4j 3.1.0 + + + + org.pcollections + pcollections + 2.1.2 +