Skip to content

Commit e710b4c

Browse files
authored
CLDR-17514 Pages too big: divide Length into Metric and Other (unicode-org#3805)
1 parent 22afc9b commit e710b4c

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

tools/cldr-code/src/main/java/org/unicode/cldr/util/PathHeader.java

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ public enum PageId {
228228
Measurement_Systems(SectionId.Units, "Measurement Systems"),
229229
Duration(SectionId.Units),
230230
Graphics(SectionId.Units),
231-
Length(SectionId.Units),
231+
Length_Metric(SectionId.Units, "Length Metric"),
232+
Length_Other(SectionId.Units, "Length Other"),
232233
Area(SectionId.Units),
233234
Volume_Metric(SectionId.Units, "Volume Metric"),
234235
Volume_US(SectionId.Units, "Volume US"),
@@ -2221,12 +2222,7 @@ private static String fix(String input, int orderIn) {
22212222
while (true) {
22222223
int functionStart = input.indexOf('&', pos);
22232224
if (functionStart < 0) {
2224-
if ("Volume".equals(input)) {
2225-
return getVolumePageId(args.value[0] /* path */).toString();
2226-
} else if ("Other Units".equals(input)) {
2227-
return getOtherUnitsPageId(args.value[0] /* path */).toString();
2228-
}
2229-
return input;
2225+
return adjustPageForPath(input, args.value[0] /* path */).toString();
22302226
}
22312227
int functionEnd = input.indexOf('(', functionStart);
22322228
int argEnd =
@@ -2246,12 +2242,35 @@ private static String fix(String input, int orderIn) {
22462242
}
22472243
}
22482244

2245+
private static String adjustPageForPath(String input, String path) {
2246+
if ("Length".equals(input)) {
2247+
return getLengthPageId(path).toString();
2248+
}
2249+
if ("Other Units".equals(input)) {
2250+
return getOtherUnitsPageId(path).toString();
2251+
}
2252+
if ("Volume".equals(input)) {
2253+
return getVolumePageId(path).toString();
2254+
}
2255+
return input;
2256+
}
2257+
22492258
private static Set<UnitConverter.UnitSystem> METRIC_UNITS =
22502259
Set.of(UnitConverter.UnitSystem.metric, UnitConverter.UnitSystem.metric_adjacent);
22512260

22522261
private static Set<UnitConverter.UnitSystem> US_UNITS =
22532262
Set.of(UnitConverter.UnitSystem.ussystem);
22542263

2264+
private static PageId getLengthPageId(String path) {
2265+
final String shortUnitId = getShortUnitId(path);
2266+
if (isSystemUnit(shortUnitId, METRIC_UNITS)) {
2267+
return PageId.Length_Metric;
2268+
} else {
2269+
// Could further subdivide into US/Other with isSystemUnit(shortUnitId, US_UNITS)
2270+
return PageId.Length_Other;
2271+
}
2272+
}
2273+
22552274
private static PageId getVolumePageId(String path) {
22562275
final String shortUnitId = getShortUnitId(path);
22572276
if (isSystemUnit(shortUnitId, METRIC_UNITS)) {

0 commit comments

Comments
 (0)