-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLDR-17560 UI for entire locale checks #3644
Merged
srl295
merged 2 commits into
unicode-org:main
from
srl295:cldr-17560/supplemental-nonpath-errs
May 2, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSupplemental.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
package org.unicode.cldr.tool; | ||
|
||
import java.io.IOException; | ||
import java.io.Writer; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.TreeSet; | ||
import org.unicode.cldr.test.CheckCLDR.CheckStatus; | ||
import org.unicode.cldr.test.CheckCLDR.SubtypeToURLProvider; | ||
import org.unicode.cldr.test.TestCache.TestResultBundle; | ||
import org.unicode.cldr.util.CLDRConfig; | ||
import org.unicode.cldr.util.CLDRFile; | ||
import org.unicode.cldr.util.CLDRPaths; | ||
import org.unicode.cldr.util.Factory; | ||
|
||
public class ChartSupplemental extends Chart { | ||
private static final CLDRConfig CLDR_CONFIG = CLDRConfig.getInstance(); | ||
static final CLDRFile ENGLISH = CLDR_CONFIG.getEnglish(); | ||
static final String DIR = CLDRPaths.CHART_DIRECTORY + "verify/supplemental/"; | ||
|
||
private final String locale; | ||
|
||
public ChartSupplemental(String locale) { | ||
super(); | ||
this.locale = locale; | ||
} | ||
|
||
@Override | ||
public String getDirectory() { | ||
return DIR; | ||
} | ||
|
||
@Override | ||
public String getTitle() { | ||
return ENGLISH.getName(locale) + ": Overall Errors"; | ||
} | ||
|
||
@Override | ||
public String getExplanation() { | ||
return "<p>This chart shows errors which apply to the entire locale.</p>"; | ||
} | ||
|
||
@Override | ||
public String getFileName() { | ||
return locale; | ||
} | ||
|
||
@Override | ||
public void writeContents( | ||
Writer pw, Factory factory, TestResultBundle test, SubtypeToURLProvider urlProvider) | ||
throws IOException { | ||
CLDRFile cldrFile = factory.make(locale, true); | ||
|
||
if (test != null) { | ||
Set<CheckStatus> pp = new TreeSet<CheckStatus>(); | ||
|
||
// add any 'early' errors | ||
pp.addAll(test.getPossibleProblems()); | ||
|
||
// add all non-path status | ||
for (final String x : cldrFile) { | ||
List<CheckStatus> result = new ArrayList<CheckStatus>(); | ||
test.check(x, result, cldrFile.getStringValue(x)); | ||
for (final CheckStatus s : result) { | ||
if (s.getEntireLocale()) pp.add(s); | ||
} | ||
} | ||
|
||
// report | ||
|
||
if (pp.isEmpty()) { | ||
pw.write("<h3>No Errors</h3>\n"); | ||
pw.write("There are no overall locale issues to report"); | ||
} else { | ||
pw.write("<h3>Overall Errors</h3>\n"); | ||
pw.write("<ol>\n"); | ||
for (final CheckStatus s : pp) { | ||
pw.write( | ||
String.format( | ||
"<li> <b>%s</b> <i title='%s'>%s</i>\n", | ||
s.getType(), s.getSubtype().name(), s.getSubtype())); | ||
pw.write("<p>" + s.getMessage() + "</p>"); | ||
if (urlProvider != null) { | ||
final String moreDetailsUrl = urlProvider.apply(s.getSubtype()); | ||
pw.write(String.format("<a href=\"%s\">more details</a>", moreDetailsUrl)); | ||
} | ||
pw.write("</li>\n"); | ||
} | ||
pw.write("</ol>\n\n"); | ||
} | ||
} | ||
|
||
pw.write("</div> <!-- ReportSupplemental -->\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never use "var" anymore. I don't know of any good reason to use it in new code. Not that it generally causes any problem, but it has an "old code" smell and raises questions like "is this variable referenced before it's declared?" and "is it declared more than once?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix in follow on