Skip to content

Commit

Permalink
CLDR-11874 Add conversion of subdivisions to json
Browse files Browse the repository at this point in the history
  • Loading branch information
Arjan Mels authored and arjanmels committed Jan 11, 2025
1 parent ed491cf commit 5b10a04
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ enum RunType {
annotations,
annotationsDerived,
bcp47(false, false),
transforms(false, false);
transforms(false, false),
subdivisions(false, true);

private final boolean isTiered;
private final boolean hasLocales;
Expand Down Expand Up @@ -748,6 +749,8 @@ private int convertCldrItems(
outFilename = filename + ".json";
} else if (type == RunType.transforms) {
outFilename = filename + ".json";
} else if (type == RunType.subdivisions) {
outFilename = filename + ".json";
} else if (js.section.equals("other")) {
// If you see other-___.json, it means items that were missing from
// JSON_config_*.txt
Expand Down Expand Up @@ -786,7 +789,8 @@ private int convertCldrItems(
}
} else if (type == RunType.rbnf
|| type == RunType.bcp47
|| type == RunType.transforms) {
|| type == RunType.transforms
|| type == RunType.subdivisions) {
// untiered, just use the name
js.packageName = type.name();
tier = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class LdmlConvertRules {
/** File sets that will not be processed in JSON transformation. */
public static final ImmutableSet<String> IGNORE_FILE_SET =
ImmutableSet.of(
"attributeValueValidity", "coverageLevels", "postalCodeData", "subdivisions");
"attributeValueValidity", "coverageLevels", "postalCodeData");

/**
* The attribute list that should become part of the name in form of name-(attribute)-(value).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Processed by LdmlConfigFileReader

# These are earlier in the file to keep the packageDesc in one place.
package=subdivisions ; packageDesc=Translated versions of locale display name elements: subdivisions.

# mapping paths to sections
section=subdivisions ; path=//cldr/subdivisions/[^/]++/localeDisplayNames/subdivisions/.* ; package=subdivisions

# Depedencies
dependency=core ; package=subdivisions
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ section=aliases ; path=//cldr/supplemental/metadata/alias/(language|script|subdi
section=units ; path=//cldr/supplemental/(unitConstants|unitQuantities|convertUnits|unitPrefixes).* ; package=core
section=unitsMetadata ; path=//cldr/supplemental/metadata/.*/(unitAlias|usageAlias).* ; package=core
section=unitIdComponents ; path=//cldr/supplemental/unitIdComponents/.* ; package=core
section=subdivisionContainment ; path=//cldr/supplemental/subdivisionContainment/.* ; package=core

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

0 comments on commit 5b10a04

Please sign in to comment.