Skip to content

Commit

Permalink
ICU-22928 Don't generate data for concentr/perbillion structure - code
Browse files Browse the repository at this point in the history
  • Loading branch information
mihnita committed Sep 27, 2024
1 parent 109008d commit 894a8a4
Showing 1 changed file with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ static void writeToFile(
this.icuData = checkNotNull(icuData);
}

// ICU-22781: start section
// TODO: remove once ICU-22781 is resolved
private final static RbPath LOCALE_PER_BILLION = RbPath.of("concentr", "portion-per-1e9");
private final static RbPath SUPLEMENTAL_UNITS = RbPath.of("idValidity", "unit", "regular");
private final static RbValue SUPLEMENTAL_PER_BILLION = RbValue.of("concentr-portion-per-1e9");
// ICU-22781: end section

// TODO: Write a UTF-8 header (see https://unicode-org.atlassian.net/browse/ICU-10197).
private void writeTo(PrintWriter out, List<String> header) {
out.write('\uFEFF');
Expand All @@ -93,6 +100,17 @@ private void writeTo(PrintWriter out, List<String> header) {

RbPath lastPath = RbPath.of();
for (RbPath path : icuData.getPaths()) {
// ICU-22781: start section
boolean mightBeSupplemental = false;
if (path.contains(LOCALE_PER_BILLION)) {
// I tried logging here, but it is too noisy.
// About 20 entries (and logging 20 lines) per locale.
continue;
}
if (path.contains(SUPLEMENTAL_UNITS)) {
mightBeSupplemental = true;
}
// ICU-22781: end section
// Close any blocks up to the common path length. Since paths are all distinct, the
// common length should always be shorter than either path. We add 1 since we must also
// account for the implicit root segment.
Expand All @@ -101,7 +119,14 @@ private void writeTo(PrintWriter out, List<String> header) {
closeLastPath(commonDepth, out);
// After opening the value will be ready for the next value to be written.
openNextPath(path, out);
valueWasInline = appendValues(icuData.getName(), path, icuData.get(path), out);
List<RbValue> values = icuData.get(path);
// ICU-22781: start section
if (mightBeSupplemental) {
System.out.println("(skipping " + SUPLEMENTAL_PER_BILLION + " until ICU-22781 is fixed)");
values.remove(SUPLEMENTAL_PER_BILLION);
}
// ICU-22781: end section
valueWasInline = appendValues(icuData.getName(), path, values, out);
lastPath = path;
}
closeLastPath(0, out);
Expand Down

0 comments on commit 894a8a4

Please sign in to comment.