Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2957,8 +2957,8 @@ private static void generateDateTimesReport(Writer out, SurveyMain sm, CLDRLocal
CLDRFile englishFile = fac.make("en", true);
CLDRFile nativeFile = fac.make(l, true);

DateTimeFormats formats = new DateTimeFormats().set(nativeFile, calendarType);
DateTimeFormats english = new DateTimeFormats().set(englishFile, calendarType);
DateTimeFormats formats = new DateTimeFormats(nativeFile, calendarType);
DateTimeFormats english = new DateTimeFormats(englishFile, calendarType);

formats.addTable(english, out);
formats.addDateTable(englishFile, out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static final CompactDecimalFormat build(

// get the common CLDR data used for number/date/time formats

ICUServiceBuilder builder = new ICUServiceBuilder().setCldrFile(resolvedCldrFile);
final ICUServiceBuilder builder = new ICUServiceBuilder(resolvedCldrFile);

DecimalFormat decimalFormat =
currencyStyle == CurrencyStyle.PLAIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class CheckDates extends FactoryCheckCLDR {
static boolean GREGORIAN_ONLY = CldrUtility.getProperty("GREGORIAN", false);
private static final Set<String> CALENDARS_FOR_CORES = Set.of("gregorian", "iso8601");

ICUServiceBuilder icuServiceBuilder = new ICUServiceBuilder();
private final ICUServiceBuilder icuServiceBuilder = new ICUServiceBuilder();
DateTimePatternGenerator.FormatParser formatParser =
new DateTimePatternGenerator.FormatParser();
DateTimePatternGenerator dateTimePatternGenerator = DateTimePatternGenerator.getEmptyInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class ExampleDependencies {
.putAll(
"//ldml/contextTransforms/contextTransformUsage[@type=\"([^\"]*+)\"]/contextTransform[@type=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativePeriod",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]/relativeTimePattern[@count=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relative[@type=\"([^\"]*+)\"]",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
Expand Down Expand Up @@ -72,6 +73,7 @@ public class ExampleDependencies {
"//ldml/dates/calendars/calendar[@type=\"([^\"]*+)\"]/months/monthContext[@type=\"([^\"]*+)\"]/monthWidth[@type=\"([^\"]*+)\"]/month[@type=\"([^\"]*+)\"][@yeartype=\"([^\"]*+)\"]",
"//ldml/dates/calendars/calendar[@type=\"([^\"]*+)\"]/quarters/quarterContext[@type=\"([^\"]*+)\"]/quarterWidth[@type=\"([^\"]*+)\"]/quarter[@type=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativePeriod",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]/relativeTimePattern[@count=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relative[@type=\"([^\"]*+)\"]",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
Expand Down Expand Up @@ -123,6 +125,7 @@ public class ExampleDependencies {
"//ldml/dates/calendars/calendar[@type=\"([^\"]*+)\"]/timeFormats/timeFormatLength[@type=\"([^\"]*+)\"]/timeFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"]",
"//ldml/dates/calendars/calendar[@type=\"([^\"]*+)\"]/timeFormats/timeFormatLength[@type=\"([^\"]*+)\"]/timeFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"][@alt=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativePeriod",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]/relativeTimePattern[@count=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relative[@type=\"([^\"]*+)\"]",
"//ldml/dates/timeZoneNames/gmtFormat",
Expand Down Expand Up @@ -167,6 +170,7 @@ public class ExampleDependencies {
"//ldml/dates/calendars/calendar[@type=\"([^\"]*+)\"]/timeFormats/timeFormatLength[@type=\"([^\"]*+)\"]/timeFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"]",
"//ldml/dates/calendars/calendar[@type=\"([^\"]*+)\"]/timeFormats/timeFormatLength[@type=\"([^\"]*+)\"]/timeFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"][@alt=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativePeriod",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]/relativeTimePattern[@count=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relative[@type=\"([^\"]*+)\"]",
"//ldml/dates/timeZoneNames/gmtFormat",
Expand Down Expand Up @@ -211,6 +215,7 @@ public class ExampleDependencies {
"//ldml/dates/calendars/calendar[@type=\"([^\"]*+)\"]/timeFormats/timeFormatLength[@type=\"([^\"]*+)\"]/timeFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"]",
"//ldml/dates/calendars/calendar[@type=\"([^\"]*+)\"]/timeFormats/timeFormatLength[@type=\"([^\"]*+)\"]/timeFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"][@alt=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativePeriod",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]/relativeTimePattern[@count=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relative[@type=\"([^\"]*+)\"]",
"//ldml/dates/timeZoneNames/gmtFormat",
Expand Down Expand Up @@ -255,6 +260,7 @@ public class ExampleDependencies {
"//ldml/dates/calendars/calendar[@type=\"([^\"]*+)\"]/timeFormats/timeFormatLength[@type=\"([^\"]*+)\"]/timeFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"]",
"//ldml/dates/calendars/calendar[@type=\"([^\"]*+)\"]/timeFormats/timeFormatLength[@type=\"([^\"]*+)\"]/timeFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"][@alt=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativePeriod",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]/relativeTimePattern[@count=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relative[@type=\"([^\"]*+)\"]",
"//ldml/dates/timeZoneNames/gmtFormat",
Expand Down Expand Up @@ -312,6 +318,7 @@ public class ExampleDependencies {
"//ldml/dates/calendars/calendar[@type=\"([^\"]*+)\"]/timeFormats/timeFormatLength[@type=\"([^\"]*+)\"]/timeFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"]",
"//ldml/dates/calendars/calendar[@type=\"([^\"]*+)\"]/timeFormats/timeFormatLength[@type=\"([^\"]*+)\"]/timeFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"][@alt=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativePeriod",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]/relativeTimePattern[@count=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relative[@type=\"([^\"]*+)\"]",
"//ldml/dates/timeZoneNames/gmtFormat",
Expand Down Expand Up @@ -356,6 +363,7 @@ public class ExampleDependencies {
"//ldml/dates/calendars/calendar[@type=\"([^\"]*+)\"]/timeFormats/timeFormatLength[@type=\"([^\"]*+)\"]/timeFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"]",
"//ldml/dates/calendars/calendar[@type=\"([^\"]*+)\"]/timeFormats/timeFormatLength[@type=\"([^\"]*+)\"]/timeFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"][@alt=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativePeriod",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]/relativeTimePattern[@count=\"([^\"]*+)\"]",
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relative[@type=\"([^\"]*+)\"]",
"//ldml/dates/timeZoneNames/gmtFormat",
Expand Down Expand Up @@ -404,6 +412,9 @@ public class ExampleDependencies {
.putAll(
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativePeriod",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
.putAll(
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
.putAll(
"//ldml/dates/fields/field[@type=\"([^\"]*+)\"]/relativeTime[@type=\"([^\"]*+)\"]/relativeTimePattern[@count=\"([^\"]*+)\"]",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
Expand Down Expand Up @@ -487,9 +498,6 @@ public class ExampleDependencies {
.putAll(
"//ldml/dates/timeZoneNames/zone[@type=\"([^\"]*+)\"]/short/daylight",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
.putAll(
"//ldml/dates/timeZoneNames/zone[@type=\"([^\"]*+)\"]/short/generic",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
Copy link
Member Author

@btangmu btangmu Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only example dependency removed. I don't know why. The implication is that examples for these namePattern paths no longer depend on values for these timeZoneNames paths.

.putAll(
"//ldml/dates/timeZoneNames/zone[@type=\"([^\"]*+)\"]/short/standard",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
Expand Down Expand Up @@ -611,6 +619,7 @@ public class ExampleDependencies {
"//ldml/localeDisplayNames/localeDisplayPattern/localeSeparator",
"//ldml/localeDisplayNames/territories/territory[@type=\"([^\"]*+)\"]",
"//ldml/localeDisplayNames/territories/territory[@type=\"([^\"]*+)\"][@alt=\"([^\"]*+)\"]",
"//ldml/personNames/nameOrderLocales[@order=\"([^\"]*+)\"]",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
.putAll(
"//ldml/localeDisplayNames/scripts/script[@type=\"([^\"]*+)\"][@alt=\"([^\"]*+)\"]",
Expand Down Expand Up @@ -742,6 +751,9 @@ public class ExampleDependencies {
.putAll(
"//ldml/numbers/currencyFormats[@numberSystem=\"([^\"]*+)\"]/currencyFormatLength/currencyFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"][@alt=\"([^\"]*+)\"]",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
.putAll(
"//ldml/numbers/currencyFormats[@numberSystem=\"([^\"]*+)\"]/currencyFormatLength[@type=\"([^\"]*+)\"]/currencyFormat[@type=\"([^\"]*+)\"]",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
.putAll(
"//ldml/numbers/currencyFormats[@numberSystem=\"([^\"]*+)\"]/currencyFormatLength[@type=\"([^\"]*+)\"]/currencyFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"][@count=\"([^\"]*+)\"]",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
Expand Down Expand Up @@ -1030,6 +1042,7 @@ public class ExampleDependencies {
"//ldml/listPatterns/listPattern[@type=\"([^\"]*+)\"]/listPatternPart[@type=\"([^\"]*+)\"]",
"//ldml/numbers/currencies/currency[@type=\"([^\"]*+)\"]/displayName[@count=\"([^\"]*+)\"]",
"//ldml/numbers/currencyFormats[@numberSystem=\"([^\"]*+)\"]/unitPattern[@count=\"([^\"]*+)\"]",
"//ldml/numbers/decimalFormats[@numberSystem=\"([^\"]*+)\"]/decimalFormatLength[@type=\"([^\"]*+)\"]/decimalFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"][@count=\"([^\"]*+)\"]",
"//ldml/numbers/minimalPairs/caseMinimalPairs[@case=\"([^\"]*+)\"]",
"//ldml/numbers/minimalPairs/ordinalMinimalPairs[@ordinal=\"([^\"]*+)\"]",
"//ldml/numbers/minimalPairs/pluralMinimalPairs[@count=\"([^\"]*+)\"]",
Expand All @@ -1050,6 +1063,9 @@ public class ExampleDependencies {
"//ldml/units/unitLength[@type=\"([^\"]*+)\"]/unit[@type=\"([^\"]*+)\"]/perUnitPattern",
"//ldml/units/unitLength[@type=\"([^\"]*+)\"]/unit[@type=\"([^\"]*+)\"]/unitPattern[@count=\"([^\"]*+)\"]",
"//ldml/units/unitLength[@type=\"([^\"]*+)\"]/unit[@type=\"([^\"]*+)\"]/unitPattern[@count=\"([^\"]*+)\"][@case=\"([^\"]*+)\"]")
.putAll(
"//ldml/numbers/decimalFormats[@numberSystem=\"([^\"]*+)\"]/decimalFormatLength[@type=\"([^\"]*+)\"]/decimalFormat[@type=\"([^\"]*+)\"]",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
.putAll(
"//ldml/numbers/decimalFormats[@numberSystem=\"([^\"]*+)\"]/decimalFormatLength[@type=\"([^\"]*+)\"]/decimalFormat[@type=\"([^\"]*+)\"]/pattern[@type=\"([^\"]*+)\"][@count=\"([^\"]*+)\"]",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
Expand Down Expand Up @@ -1752,6 +1768,9 @@ public class ExampleDependencies {
.putAll(
"//ldml/units/durationUnit[@type=\"([^\"]*+)\"]/durationUnitPattern[@alt=\"([^\"]*+)\"]",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
.putAll(
"//ldml/units/unitLength[@type=\"([^\"]*+)\"]/compoundUnit[@type=\"([^\"]*+)\"]",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
.putAll(
"//ldml/units/unitLength[@type=\"([^\"]*+)\"]/compoundUnit[@type=\"([^\"]*+)\"]/compoundUnitPattern",
"//ldml/personNames/personName[@order=\"([^\"]*+)\"][@length=\"([^\"]*+)\"][@usage=\"([^\"]*+)\"][@formality=\"([^\"]*+)\"]/namePattern")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public void setCachingEnabled(boolean enabled) {

private final ExampleCache exCache = new ExampleCache();

private final ICUServiceBuilder icuServiceBuilder = new ICUServiceBuilder();
private final ICUServiceBuilder icuServiceBuilder;

private final PluralInfo pluralInfo;

Expand Down Expand Up @@ -359,9 +359,7 @@ public CLDRFile getCldrFile() {
*/
public void updateCache(String xpath) {
exCache.update(xpath);
if (ICUServiceBuilder.ISB_CAN_CLEAR_CACHE) {
icuServiceBuilder.clearCache();
}
icuServiceBuilder.clearCache();
}

/**
Expand Down Expand Up @@ -438,7 +436,7 @@ public ExampleGenerator(CLDRFile resolvedCldrFile, CLDRFile englishFile) {
supplementalDataInfo.getGrammarInfo(localeId); // getGrammarInfo can return null
this.englishFile = englishFile;
this.typeIsEnglish = (resolvedCldrFile == englishFile);
icuServiceBuilder.setCldrFile(resolvedCldrFile);
this.icuServiceBuilder = new ICUServiceBuilder(resolvedCldrFile);

bestMinimalPairSamples = new BestMinimalPairSamples(cldrFile, icuServiceBuilder, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,7 @@ static void checkStock(Factory factory) {
continue;
}
CLDRFile file = factory.make(locale, false);
DateTimeFormats dtf = new DateTimeFormats();
dtf.set(file, "gregorian", false);
DateTimeFormats dtf = new DateTimeFormats(file, "gregorian", false);
for (String[] stockInfo : items) {
String length = stockInfo[0];
// ldml/dates/calendars/calendar[@type="gregorian"]/dateFormats/dateFormatLength[@type="full"]/dateFormat[@type="standard"]/pattern[@type="standard"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ private static TestCase computeTestCase(
// compute the expected
// TODO: fix CLDR DateTimeFormats constructor to use CLDRFile to get the dateTimeFormat
// glue pattern rather than use ICU to get it
DateTimeFormats formats = new DateTimeFormats().set(localeCldrFile, calendarStr, false);
DateTimeFormats formats = new DateTimeFormats(localeCldrFile, calendarStr, false);
SimpleDateFormat formatterForSkeleton = formats.getDateFormatFromSkeleton(skeleton);
formatterForSkeleton.setCalendar(testCaseInput.calendar);
formatterForSkeleton.setTimeZone(testCaseInput.timeZone);
Expand Down Expand Up @@ -1173,9 +1173,7 @@ public static ImmutableSet<TestCase> getKernelTestCases() {
continue;
}

ICUServiceBuilder icuServiceBuilder = new ICUServiceBuilder();
icuServiceBuilder.clearCache();
icuServiceBuilder.setCldrFile(localeCldrFile);
ICUServiceBuilder icuServiceBuilder = new ICUServiceBuilder(localeCldrFile);

for (FieldStyleComboInput input : getFieldStyleComboInputs()) {
assert input.shouldMultiplyByDateTime || input.shouldMultiplyByTimeZone;
Expand Down
Loading
Loading