Skip to content

Commit 7eedaac

Browse files
committed
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
1 parent 6c3be6b commit 7eedaac

File tree

7 files changed

+20
-5
lines changed

7 files changed

+20
-5
lines changed

tools/cldr-apps/js/src/esm/cldrSurvey.mjs

+13-1
Original file line numberDiff line numberDiff line change
@@ -752,8 +752,15 @@ function testsToHtml(tests) {
752752
if (!tests) {
753753
return newHtml;
754754
}
755+
var hadEntireLocale = false;
756+
755757
for (var i = 0; i < tests.length; i++) {
756758
var testItem = tests[i];
759+
const { entireLocale } = testItem;
760+
if (entireLocale) {
761+
hadEntireLocale = true;
762+
continue;
763+
}
757764
newHtml += "<p class='trInfo tr_" + testItem.type;
758765
if (testItem.type == "Warning") {
759766
newHtml += " alert alert-warning fix-popover-help";
@@ -780,7 +787,12 @@ function testsToHtml(tests) {
780787
newHtml += ' <a href="' + testItem.subtypeUrl + '">(how to fix…)</a>';
781788
}
782789

783-
newHtml += "</p>";
790+
newHtml += "</p>\n";
791+
}
792+
if (hadEntireLocale) {
793+
newHtml += `<p class='trInfo tr_Warning alert alert-warning fix-popover-help'>See also <a href='#r_supplemental/${cldrStatus.getCurrentLocale()}//'>${cldrText.get(
794+
"special_r_supplemental"
795+
)}</a></p>\n`;
784796
}
785797
return newHtml;
786798
}

tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyJSONWrapper.java

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public static JSONObject wrap(CheckStatus status) throws JSONException {
6767
put("subtype", subtype.name());
6868
put("subtypeUrl", SubtypeToURLMap.forSubtype(subtype)); // could be null.
6969
}
70+
put("entireLocale", cs.getEntireLocale());
7071
}
7172
};
7273
}

tools/cldr-apps/src/main/java/org/unicode/cldr/web/api/VoteAPI.java

+2
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ public static final class CheckStatusSummary {
352352
public String subtypeUrl;
353353
public Phase phase;
354354
public String cause;
355+
public boolean entireLocale;
355356

356357
public CheckStatusSummary(CheckStatus checkStatus) {
357358
this.message = checkStatus.getMessage();
@@ -366,6 +367,7 @@ public CheckStatusSummary(CheckStatus checkStatus) {
366367
if (this.subtype != null) {
367368
this.subtypeUrl = SubtypeToURLMap.forSubtype(this.subtype); // could be null.
368369
}
370+
this.entireLocale = checkStatus.getEntireLocale();
369371
}
370372
}
371373
}

tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ public static boolean hasType(List<CheckStatus> result, Type type) {
11311131
/**
11321132
* @returns true if this status applies to the entire locale, not a single path
11331133
*/
1134-
public boolean isEntireLocale() {
1134+
public boolean getEntireLocale() {
11351135
return entireLocale;
11361136
}
11371137

tools/cldr-code/src/main/java/org/unicode/cldr/test/ConsoleCheckCLDR.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ public static void main(String[] args) throws Throwable {
777777
boolean showedOne = false;
778778
for (Iterator<CheckStatus> it3 = result.iterator(); it3.hasNext(); ) {
779779
CheckStatus status = it3.next();
780-
if (status.isEntireLocale()) {
780+
if (status.getEntireLocale()) {
781781
possibleProblems.add(status);
782782
continue;
783783
}

tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSupplemental.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void writeContents(
6363
List<CheckStatus> result = new ArrayList<CheckStatus>();
6464
test.check(x, result, cldrFile.getStringValue(x));
6565
for (final CheckStatus s : result) {
66-
if (s.isEntireLocale()) pp.add(s);
66+
if (s.getEntireLocale()) pp.add(s);
6767
}
6868
}
6969

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public Status getErrorStatus(
197197
StringBuilder errorMessage = new StringBuilder();
198198
factory.getTestCache().getBundle(options).check(path, result, value);
199199
for (CheckStatus checkStatus : result) {
200-
if (checkStatus.isEntireLocale())
200+
if (checkStatus.getEntireLocale())
201201
continue; // these will show up in the Entire Locale (supplemental) report
202202
final CheckCLDR cause = checkStatus.getCause();
203203
/*

0 commit comments

Comments
 (0)