From 7774140f3ab21b566b1ae558ff14178ad7338827 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Fri, 26 Apr 2024 13:41:02 -0500 Subject: [PATCH] CLDR-17560 CheckCLDR UI for non-path checks - rollup non-path checks into a single warning in the info panel - fix Voting API to expose this data --- tools/cldr-apps/js/src/esm/cldrSurvey.mjs | 14 +++++++++++++- .../org/unicode/cldr/web/SurveyJSONWrapper.java | 1 + .../java/org/unicode/cldr/web/api/VoteAPI.java | 2 ++ .../main/java/org/unicode/cldr/test/CheckCLDR.java | 2 +- .../org/unicode/cldr/test/ConsoleCheckCLDR.java | 2 +- .../org/unicode/cldr/tool/ChartSupplemental.java | 2 +- .../java/org/unicode/cldr/util/VettingViewer.java | 2 +- 7 files changed, 20 insertions(+), 5 deletions(-) diff --git a/tools/cldr-apps/js/src/esm/cldrSurvey.mjs b/tools/cldr-apps/js/src/esm/cldrSurvey.mjs index 48d4591d11a..2d348f10316 100644 --- a/tools/cldr-apps/js/src/esm/cldrSurvey.mjs +++ b/tools/cldr-apps/js/src/esm/cldrSurvey.mjs @@ -752,8 +752,15 @@ function testsToHtml(tests) { if (!tests) { return newHtml; } + var hadEntireLocale = false; + for (var i = 0; i < tests.length; i++) { var testItem = tests[i]; + const { entireLocale } = testItem; + if (entireLocale) { + hadEntireLocale = true; + continue; + } newHtml += "

(how to fix…)'; } - newHtml += "

"; + newHtml += "

\n"; + } + if (hadEntireLocale) { + newHtml += `

See also ${cldrText.get( + "special_r_supplemental" + )}

\n`; } return newHtml; } diff --git a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyJSONWrapper.java b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyJSONWrapper.java index 90d340b4ee6..31c14886316 100644 --- a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyJSONWrapper.java +++ b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyJSONWrapper.java @@ -67,6 +67,7 @@ public static JSONObject wrap(CheckStatus status) throws JSONException { put("subtype", subtype.name()); put("subtypeUrl", SubtypeToURLMap.forSubtype(subtype)); // could be null. } + put("entireLocale", cs.getEntireLocale()); } }; } diff --git a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/api/VoteAPI.java b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/api/VoteAPI.java index 544f482d433..b0ec3882a92 100644 --- a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/api/VoteAPI.java +++ b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/api/VoteAPI.java @@ -352,6 +352,7 @@ public static final class CheckStatusSummary { public String subtypeUrl; public Phase phase; public String cause; + public boolean entireLocale; public CheckStatusSummary(CheckStatus checkStatus) { this.message = checkStatus.getMessage(); @@ -366,6 +367,7 @@ public CheckStatusSummary(CheckStatus checkStatus) { if (this.subtype != null) { this.subtypeUrl = SubtypeToURLMap.forSubtype(this.subtype); // could be null. } + this.entireLocale = checkStatus.getEntireLocale(); } } } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java index 216be34d360..176071700e0 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java @@ -1131,7 +1131,7 @@ public static boolean hasType(List result, Type type) { /** * @returns true if this status applies to the entire locale, not a single path */ - public boolean isEntireLocale() { + public boolean getEntireLocale() { return entireLocale; } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/ConsoleCheckCLDR.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/ConsoleCheckCLDR.java index eeefa83326c..b03e5caa6ae 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/ConsoleCheckCLDR.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/ConsoleCheckCLDR.java @@ -777,7 +777,7 @@ public static void main(String[] args) throws Throwable { boolean showedOne = false; for (Iterator it3 = result.iterator(); it3.hasNext(); ) { CheckStatus status = it3.next(); - if (status.isEntireLocale()) { + if (status.getEntireLocale()) { possibleProblems.add(status); continue; } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSupplemental.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSupplemental.java index e8059ed25b0..2b287892939 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSupplemental.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSupplemental.java @@ -63,7 +63,7 @@ public void writeContents( List result = new ArrayList(); test.check(x, result, cldrFile.getStringValue(x)); for (final CheckStatus s : result) { - if (s.isEntireLocale()) pp.add(s); + if (s.getEntireLocale()) pp.add(s); } } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/VettingViewer.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/VettingViewer.java index c6a6c830dea..0b6b2b3dac0 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/VettingViewer.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/VettingViewer.java @@ -197,7 +197,7 @@ public Status getErrorStatus( StringBuilder errorMessage = new StringBuilder(); factory.getTestCache().getBundle(options).check(path, result, value); for (CheckStatus checkStatus : result) { - if (checkStatus.isEntireLocale()) + if (checkStatus.getEntireLocale()) continue; // these will show up in the Entire Locale (supplemental) report final CheckCLDR cause = checkStatus.getCause(); /*