From e710b4c17cf1f3afc0433e2b549cf77e2c9688fb Mon Sep 17 00:00:00 2001 From: Tom Bishop Date: Thu, 13 Jun 2024 15:42:55 -0400 Subject: [PATCH] CLDR-17514 Pages too big: divide Length into Metric and Other (#3805) --- .../org/unicode/cldr/util/PathHeader.java | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/PathHeader.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/PathHeader.java index 4768aac4a46..c9a37ddf49a 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/PathHeader.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/PathHeader.java @@ -228,7 +228,8 @@ public enum PageId { Measurement_Systems(SectionId.Units, "Measurement Systems"), Duration(SectionId.Units), Graphics(SectionId.Units), - Length(SectionId.Units), + Length_Metric(SectionId.Units, "Length Metric"), + Length_Other(SectionId.Units, "Length Other"), Area(SectionId.Units), Volume_Metric(SectionId.Units, "Volume Metric"), Volume_US(SectionId.Units, "Volume US"), @@ -2221,12 +2222,7 @@ private static String fix(String input, int orderIn) { while (true) { int functionStart = input.indexOf('&', pos); if (functionStart < 0) { - if ("Volume".equals(input)) { - return getVolumePageId(args.value[0] /* path */).toString(); - } else if ("Other Units".equals(input)) { - return getOtherUnitsPageId(args.value[0] /* path */).toString(); - } - return input; + return adjustPageForPath(input, args.value[0] /* path */).toString(); } int functionEnd = input.indexOf('(', functionStart); int argEnd = @@ -2246,12 +2242,35 @@ private static String fix(String input, int orderIn) { } } + private static String adjustPageForPath(String input, String path) { + if ("Length".equals(input)) { + return getLengthPageId(path).toString(); + } + if ("Other Units".equals(input)) { + return getOtherUnitsPageId(path).toString(); + } + if ("Volume".equals(input)) { + return getVolumePageId(path).toString(); + } + return input; + } + private static Set METRIC_UNITS = Set.of(UnitConverter.UnitSystem.metric, UnitConverter.UnitSystem.metric_adjacent); private static Set US_UNITS = Set.of(UnitConverter.UnitSystem.ussystem); + private static PageId getLengthPageId(String path) { + final String shortUnitId = getShortUnitId(path); + if (isSystemUnit(shortUnitId, METRIC_UNITS)) { + return PageId.Length_Metric; + } else { + // Could further subdivide into US/Other with isSystemUnit(shortUnitId, US_UNITS) + return PageId.Length_Other; + } + } + private static PageId getVolumePageId(String path) { final String shortUnitId = getShortUnitId(path); if (isSystemUnit(shortUnitId, METRIC_UNITS)) {