Skip to content

Commit 3a26d44

Browse files
committed
CLDR-19110 Updates
1 parent 2ccc2bb commit 3a26d44

File tree

3 files changed

+182
-91
lines changed

3 files changed

+182
-91
lines changed

common/dtd/ldmlSupplemental.dtd

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ CLDR data files are interpreted according to the LDML specification (http://unic
77

88
<!ELEMENT supplementalData ( version, generation?, cldrVersion?, currencyData?, territoryContainment?, subdivisionContainment?, languageData?, scriptData?, territoryInfo?, postalCodeData?, calendarData?, calendarPreferenceData?, weekData?, timeData?, measurementData?, unitIdComponents?, unitPrefixes?, unitConstants*, unitQuantities*, convertUnits*, unitPreferenceData?, timezoneData?, characters?, transforms?, metadata?, codeMappings?, parentLocales*, personNamesDefaults?, likelySubtags?, metazoneInfo?, plurals?, telephoneCodeData?, numberingSystems?, bcp47KeywordMappings?, gender?, references?, languageMatching?, dayPeriodRuleSet*, metaZones?, primaryZones?, windowsZones?, coverageLevels?, idValidity?, rgScope?, languageGroups?, grammaticalData? ) >
99

10+
<!ATTLIST supplementalData version CDATA #IMPLIED >
11+
<!--@MATCH:any-->
12+
<!--@METADATA-->
13+
<!--@DEPRECATED-->
14+
1015
<!ELEMENT version EMPTY >
1116
<!--@METADATA-->
1217
<!ATTLIST version number CDATA #REQUIRED >
@@ -300,7 +305,6 @@ CLDR data files are interpreted according to the LDML specification (http://unic
300305
<!--@MATCH:set/validity/region/all-->
301306
<!--@VALUE-->
302307
<!ATTLIST minDays draft (approved | contributed | provisional | unconfirmed | true | false) #IMPLIED >
303-
<!--@METADATA-->
304308
<!--@DEPRECATED:true, false-->
305309
<!ATTLIST minDays references CDATA #IMPLIED >
306310
<!--@METADATA-->
@@ -313,7 +317,6 @@ CLDR data files are interpreted according to the LDML specification (http://unic
313317
<!--@MATCH:set/validity/region/all-->
314318
<!--@VALUE-->
315319
<!ATTLIST firstDay draft (approved | contributed | provisional | unconfirmed | true | false) #IMPLIED >
316-
<!--@METADATA-->
317320
<!--@DEPRECATED:true, false-->
318321
<!ATTLIST firstDay references CDATA #IMPLIED >
319322
<!--@MATCH:any-->

tools/cldr-code/src/main/java/org/unicode/cldr/tool/CldrVersion.java

Lines changed: 85 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
import com.ibm.icu.impl.locale.XCldrStub.ImmutableMap;
66
import com.ibm.icu.util.VersionInfo;
77
import java.io.File;
8+
import java.time.Instant;
9+
import java.time.ZoneId;
10+
import java.time.ZonedDateTime;
11+
import java.util.ArrayList;
12+
import java.util.Arrays;
13+
import java.util.Collections;
814
import java.util.EnumSet;
915
import java.util.LinkedHashMap;
1016
import java.util.LinkedHashSet;
@@ -25,62 +31,63 @@
2531
// TODO merge with all other copies of the CLDR version and replace with supplemental metadata,
2632
// CLDR-9149
2733
public enum CldrVersion {
28-
unknown,
29-
v1_1,
30-
v1_1_1,
31-
v1_2,
32-
v1_3,
33-
v1_4,
34-
v1_4_1,
35-
v1_5_0_1,
36-
v1_5_1,
37-
v1_6_1,
38-
v1_7_2,
39-
v1_8_1,
40-
v1_9_1,
41-
v2_0_1,
42-
v21_0,
43-
v22_1,
44-
v23_1,
45-
v24_0,
46-
v25_0,
47-
v26_0,
48-
v27_0,
49-
v28_0,
50-
v29_0,
51-
v30_0,
52-
v31_0,
53-
v32_0,
54-
v33_0,
55-
v33_1,
56-
v34_0,
57-
v35_0,
58-
v35_1,
59-
v36_0,
60-
v36_1,
61-
v37_0,
62-
v38_0,
63-
v38_1,
64-
v39_0,
65-
v40_0,
66-
v41_0,
67-
v42_0,
68-
v43_0,
69-
v44_0,
70-
v44_1,
71-
v45_0,
72-
v46_0,
73-
v46_1,
74-
v47_0,
75-
v48_0,
34+
unknown(""),
35+
v1_1("2004-06-08"),
36+
v1_1_1("2004-07-29"),
37+
v1_2("2004-11-04"),
38+
v1_3("2005-06-02"),
39+
v1_4("2006-07-17"),
40+
v1_4_1("2006-11-03"),
41+
v1_5_0_1("2007-07-31"),
42+
v1_5_1("2007-12-21"),
43+
v1_6_1("2008-07-23"),
44+
v1_7_2("2009-12-10"),
45+
v1_8_1("2010-04-29"),
46+
v1_9_1("2011-03-11"),
47+
v2_0_1("2011-07-18"),
48+
v21_0("2012-02-10"),
49+
v22_1("2012-10-26"),
50+
v23_1("2013-05-15"),
51+
v24_0("2013-09-18"),
52+
v25_0("2014-03-19"),
53+
v26_0("2014-09-18"),
54+
v27_0("2015-03-19"),
55+
v28_0("2015-09-17"),
56+
v29_0("2016-03-16"),
57+
v30_0("2016-10-05"),
58+
v31_0("2017-03-20"),
59+
v32_0("2017-11-01"),
60+
v33_0("2018-03-26"),
61+
v33_1("2018-06-20"),
62+
v34_0("2018-10-15"),
63+
v35_0("2019-03-27"),
64+
v35_1("2019-04-17"),
65+
v36_0("2019-10-04"),
66+
v36_1("2020-03-11"),
67+
v37_0("2020-04-23"),
68+
v38_0("2020-10-28"),
69+
v38_1("2020-12-17"),
70+
v39_0("2021-04-07"),
71+
v40_0("2021-10-27"),
72+
v41_0("2022-04-06"),
73+
v42_0("2022-10-19"),
74+
v43_0("2023-04-12"),
75+
v44_0("2023-10-31"),
76+
v44_1("2023-12-13"),
77+
v45_0("2024-04-17"),
78+
v46_0("2024-10-24"),
79+
v46_1("2024-12-18"),
80+
v47_0("2025-03-13"),
81+
v48_0("2025-10-29"),
7682
/**
7783
* @see CLDRFile#GEN_VERSION
7884
*/
79-
baseline;
85+
baseline("");
8086

8187
private final String baseDirectory;
8288
private final String dotName;
8389
private final VersionInfo versionInfo;
90+
private final Instant date;
8491

8592
/**
8693
* Get the closest available version (successively dropping lower-significance values) We do
@@ -118,6 +125,16 @@ public static CldrVersion from(String versionString) {
118125
: versionString);
119126
}
120127

128+
public Instant getDate() {
129+
return date;
130+
}
131+
132+
static final ZoneId Z = ZoneId.of("GMT");
133+
134+
public int getYear() {
135+
return ZonedDateTime.ofInstant(date, Z).getYear();
136+
}
137+
121138
public VersionInfo getVersionInfo() {
122139
return versionInfo;
123140
}
@@ -135,7 +152,7 @@ public boolean isOlderThan(CldrVersion other) {
135152
return compareTo(other) < 0;
136153
}
137154

138-
private CldrVersion() {
155+
private CldrVersion(String date) {
139156
String oldName = name();
140157
if (oldName.charAt(0) == 'v') {
141158
dotName = oldName.substring(1).replace('_', '.');
@@ -147,12 +164,14 @@ private CldrVersion() {
147164
final VersionInfo cldrVersion = VersionInfo.getInstance(CLDRFile.GEN_VERSION);
148165
versionInfo = "baseline".equals(oldName) ? cldrVersion : VersionInfo.getInstance(0);
149166
}
167+
this.date = date.isEmpty() ? null : Instant.parse(date + "T00:00:00Z");
150168
}
151169

152170
public static final CldrVersion LAST_RELEASE_VERSION = values()[values().length - 2];
153171
public static final List<CldrVersion> CLDR_VERSIONS_ASCENDING;
154172
public static final List<CldrVersion> CLDR_VERSIONS_DESCENDING;
155173
private static final Map<VersionInfo, CldrVersion> versionInfoToCldrVersion;
174+
public static final List<CldrVersion> LAST_RELEASE_EACH_YEAR;
156175

157176
static {
158177
EnumSet<CldrVersion> temp = EnumSet.allOf(CldrVersion.class);
@@ -176,6 +195,22 @@ private CldrVersion() {
176195
}
177196
}
178197
versionInfoToCldrVersion = ImmutableMap.copyOf(temp2);
198+
199+
List<CldrVersion> lastReleaseEachYear = new ArrayList<>();
200+
int lastYear = -1;
201+
ArrayList<CldrVersion> descending = new ArrayList<>(Arrays.asList(CldrVersion.values()));
202+
Collections.reverse(descending);
203+
for (CldrVersion v : descending) {
204+
if (v == CldrVersion.baseline || v == CldrVersion.unknown) {
205+
continue;
206+
}
207+
int year = v.getYear();
208+
if (year != lastYear) {
209+
lastReleaseEachYear.add(v);
210+
lastYear = year;
211+
}
212+
}
213+
LAST_RELEASE_EACH_YEAR = List.copyOf(lastReleaseEachYear);
179214
}
180215

181216
public List<File> getPathsForFactory() {

0 commit comments

Comments
 (0)