Skip to content

Commit

Permalink
CLDR-17402 json: drop _cldrVersion path (#3863)
Browse files Browse the repository at this point in the history
  • Loading branch information
srl295 authored Jul 15, 2024
1 parent 7e241ba commit 6f048e4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ private Map<JSONSection, List<CldrItem>> mapPathsToSections(
Matcher noNumberingSystemMatcher = LdmlConvertRules.NO_NUMBERING_SYSTEM_PATTERN.matcher("");
Matcher numberingSystemMatcher = LdmlConvertRules.NUMBERING_SYSTEM_PATTERN.matcher("");
Matcher rootIdentityMatcher = LdmlConvertRules.ROOT_IDENTITY_PATTERN.matcher("");
Matcher versionMatcher = LdmlConvertRules.VERSION_PATTERN.matcher("");
Set<String> activeNumberingSystems = new TreeSet<>();
activeNumberingSystems.add("latn"); // Always include latin script numbers
for (String np : LdmlConvertRules.ACTIVE_NUMBERING_SYSTEM_XPATHS) {
Expand Down Expand Up @@ -588,11 +589,19 @@ private Map<JSONSection, List<CldrItem>> mapPathsToSections(
continue;
}
// Discard root identity element unless the locale is root
// TODO: CLDR-17790 this code should not be needed.
rootIdentityMatcher.reset(fullPath);
if (rootIdentityMatcher.matches() && !"root".equals(locID)) {
continue;
}

// discard version stuff
versionMatcher.reset(fullPath);
if (versionMatcher.matches()) {
// drop //ldml/identity/version entirely.
continue;
}

// automatically filter out number symbols and formats without a numbering system
noNumberingSystemMatcher.reset(fullPath);
if (noNumberingSystemMatcher.matches()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,12 @@ public static class SplittableAttributeSpec {
public static final Pattern ROOT_IDENTITY_PATTERN =
Pattern.compile("//ldml/identity/language\\[@type=\"root\"\\]");

/**
* Version (coming from DTD) should be discarded everywhere. This information is now in
* package.json.
*/
public static final Pattern VERSION_PATTERN = Pattern.compile("//ldml/identity/version.*");

/** A simple class to hold the specification of a path transformation. */
public static class PathTransformSpec {

Expand Down

0 comments on commit 6f048e4

Please sign in to comment.