-
Notifications
You must be signed in to change notification settings - Fork 386
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-15882 add a test to verify coverage for locale names #3936
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
import java.util.TreeSet; | ||
import org.unicode.cldr.draft.ScriptMetadata; | ||
import org.unicode.cldr.draft.ScriptMetadata.Info; | ||
import org.unicode.cldr.test.SubmissionLocales; | ||
import org.unicode.cldr.tool.LikelySubtags; | ||
import org.unicode.cldr.util.CLDRConfig; | ||
import org.unicode.cldr.util.CLDRFile; | ||
|
@@ -36,6 +37,7 @@ | |
import org.unicode.cldr.util.ChainedMap.M3; | ||
import org.unicode.cldr.util.CldrUtility; | ||
import org.unicode.cldr.util.Containment; | ||
import org.unicode.cldr.util.CoverageInfo; | ||
import org.unicode.cldr.util.Factory; | ||
import org.unicode.cldr.util.LanguageTagParser; | ||
import org.unicode.cldr.util.Level; | ||
|
@@ -323,10 +325,14 @@ | |
public void TestMissingInfoForLanguage() { | ||
CLDRFile english = CLDR_CONFIG.getEnglish().getUnresolved(); | ||
|
||
// this is the calculated coverage - coverageLevels.txt | ||
CalculatedCoverageLevels ccl = CalculatedCoverageLevels.getInstance(); | ||
|
||
CoverageInfo covInfo = CLDR_CONFIG.getCoverageInfo(); | ||
|
||
for (String language : CLDR_CONFIG.getCldrFactory().getAvailableLanguages()) { | ||
if (language.contains("_") || language.equals("root")) { | ||
// skip root and any sublocales (scripts, regions, variants, etc.) | ||
continue; | ||
} | ||
String likelyExpansion = likely.get(language); | ||
|
@@ -335,6 +341,7 @@ | |
} else { | ||
logln("Likely subtags for " + language + ":\t " + likely); | ||
} | ||
// path for the name | ||
String path = CLDRFile.getKey(CLDRFile.LANGUAGE_NAME, language); | ||
String englishName = english.getStringValue(path); | ||
if (englishName == null) { | ||
|
@@ -349,6 +356,30 @@ | |
} | ||
errln("Missing English translation for: " + language + " which is at " + covLevel); | ||
} | ||
// now, check general coverage level. Use "und" so it is neutral. | ||
Level undCovLevel = covInfo.getCoverageLevel(path, "und"); | ||
if (undCovLevel == null || undCovLevel.isAbove(Level.MODERN)) { | ||
// What is the coverage level of the language? | ||
final Level langCovLevel = ccl.getEffectiveCoverageLevel(language); | ||
// Is it a TC org locale? | ||
final boolean isTcLocale = | ||
SubmissionLocales.isTcLocale(CLDRLocale.getInstance(language)); | ||
|
||
if (!isTcLocale && (langCovLevel == null || !langCovLevel.isAtLeast(Level.BASIC))) { | ||
continue; // skip: Neither a TC locale nor at least BASIC. | ||
} | ||
errln( | ||
Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java GitHub Actions / build
Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java GitHub Actions / build
Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java GitHub Actions / build
Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java GitHub Actions / build
Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java GitHub Actions / build
Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java GitHub Actions / build
Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java GitHub Actions / build
Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java GitHub Actions / build
Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java GitHub Actions / build
Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java GitHub Actions / build
|
||
"Language " | ||
+ language | ||
+ ": fix coverageLevels.txt: Expected MODERN but got " | ||
+ undCovLevel | ||
+ " for " | ||
+ path | ||
+ " - tcLocale:" | ||
+ isTcLocale | ||
+ ", locale calculated coverage:" | ||
+ langCovLevel); | ||
} | ||
} | ||
} | ||
|
||
|
@@ -547,7 +578,7 @@ | |
} | ||
|
||
if (!collectedBad.isEmpty()) { | ||
warnln( | ||
Check warning on line 581 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java GitHub Actions / build
|
||
"Locales have " | ||
+ collectedBad.size() | ||
+ " unexpected characters in main and/or aux:\t" | ||
|
@@ -781,7 +812,7 @@ | |
// SUPPLEMENTAL_DATA_INFO.getLikelyOrigins().get(value); | ||
// fieldToOrigin.put(value, origin == null ? "n/a" : origin); | ||
// } | ||
warnln("Bad status=" + entry.getKey() + " for " + entry.getValue()); | ||
} | ||
} | ||
} | ||
|
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.
This is the check that should only be done if the last-release's effective coverage level is > Modern.