From d1440fe0b028ffc4929243efbae7033108191884 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Fri, 12 Jul 2024 11:37:11 -0500 Subject: [PATCH] CLDR-17402 json: drop _cldrVersion path - drop //ldml/identity/version entirely (was producing _cldrVersion in every file) - also, annotate the code working around CLDR-17790 as a TODO --- .../java/org/unicode/cldr/json/Ldml2JsonConverter.java | 9 +++++++++ .../java/org/unicode/cldr/json/LdmlConvertRules.java | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/json/Ldml2JsonConverter.java b/tools/cldr-code/src/main/java/org/unicode/cldr/json/Ldml2JsonConverter.java index 3c2ab1dfe3a..f7c9ef3e06e 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/json/Ldml2JsonConverter.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/json/Ldml2JsonConverter.java @@ -540,6 +540,7 @@ private Map> 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 activeNumberingSystems = new TreeSet<>(); activeNumberingSystems.add("latn"); // Always include latin script numbers for (String np : LdmlConvertRules.ACTIVE_NUMBERING_SYSTEM_XPATHS) { @@ -588,11 +589,19 @@ private Map> 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()) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/json/LdmlConvertRules.java b/tools/cldr-code/src/main/java/org/unicode/cldr/json/LdmlConvertRules.java index e1eb03ec4e1..7e890aa5052 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/json/LdmlConvertRules.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/json/LdmlConvertRules.java @@ -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 {