Skip to content

Commit 5b10a04

Browse files
Arjan Melsarjanmels
Arjan Mels
authored andcommitted
CLDR-11874 Add conversion of subdivisions to json
1 parent ed491cf commit 5b10a04

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

tools/cldr-code/src/main/java/org/unicode/cldr/json/Ldml2JsonConverter.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ enum RunType {
102102
annotations,
103103
annotationsDerived,
104104
bcp47(false, false),
105-
transforms(false, false);
105+
transforms(false, false),
106+
subdivisions(false, true);
106107

107108
private final boolean isTiered;
108109
private final boolean hasLocales;
@@ -748,6 +749,8 @@ private int convertCldrItems(
748749
outFilename = filename + ".json";
749750
} else if (type == RunType.transforms) {
750751
outFilename = filename + ".json";
752+
} else if (type == RunType.subdivisions) {
753+
outFilename = filename + ".json";
751754
} else if (js.section.equals("other")) {
752755
// If you see other-___.json, it means items that were missing from
753756
// JSON_config_*.txt
@@ -786,7 +789,8 @@ private int convertCldrItems(
786789
}
787790
} else if (type == RunType.rbnf
788791
|| type == RunType.bcp47
789-
|| type == RunType.transforms) {
792+
|| type == RunType.transforms
793+
|| type == RunType.subdivisions) {
790794
// untiered, just use the name
791795
js.packageName = type.name();
792796
tier = "";

tools/cldr-code/src/main/java/org/unicode/cldr/json/LdmlConvertRules.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class LdmlConvertRules {
1919
/** File sets that will not be processed in JSON transformation. */
2020
public static final ImmutableSet<String> IGNORE_FILE_SET =
2121
ImmutableSet.of(
22-
"attributeValueValidity", "coverageLevels", "postalCodeData", "subdivisions");
22+
"attributeValueValidity", "coverageLevels", "postalCodeData");
2323

2424
/**
2525
* The attribute list that should become part of the name in form of name-(attribute)-(value).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Processed by LdmlConfigFileReader
2+
3+
# These are earlier in the file to keep the packageDesc in one place.
4+
package=subdivisions ; packageDesc=Translated versions of locale display name elements: subdivisions.
5+
6+
# mapping paths to sections
7+
section=subdivisions ; path=//cldr/subdivisions/[^/]++/localeDisplayNames/subdivisions/.* ; package=subdivisions
8+
9+
# Depedencies
10+
dependency=core ; package=subdivisions

tools/cldr-code/src/main/resources/org/unicode/cldr/json/JSON_config_supplemental.txt

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ section=aliases ; path=//cldr/supplemental/metadata/alias/(language|script|subdi
3434
section=units ; path=//cldr/supplemental/(unitConstants|unitQuantities|convertUnits|unitPrefixes).* ; package=core
3535
section=unitsMetadata ; path=//cldr/supplemental/metadata/.*/(unitAlias|usageAlias).* ; package=core
3636
section=unitIdComponents ; path=//cldr/supplemental/unitIdComponents/.* ; package=core
37+
section=subdivisionContainment ; path=//cldr/supplemental/subdivisionContainment/.* ; package=core
3738

3839
# ignored items
3940
section=IGNORE ; path=//cldr/supplemental/metadata/serialElements.* ; package=IGNORE

0 commit comments

Comments
 (0)