Skip to content

Commit

Permalink
CLDR-15882 add a test to verify coverage for locale names
Browse files Browse the repository at this point in the history
  • Loading branch information
srl295 committed Aug 6, 2024
1 parent afeea35 commit 1976c60
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -323,10 +325,14 @@ public void TestForMissingScriptMetadata() {
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);
Expand All @@ -335,6 +341,7 @@ public void TestMissingInfoForLanguage() {
} 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) {
Expand All @@ -349,6 +356,30 @@ public void TestMissingInfoForLanguage() {
}
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

View workflow job for this annotation

GitHub Actions / build

(LikelySubtagsTest.java:371) Error: Language ak: fix coverageLevels.txt: Expected MODERN but got comprehensive for //ldml/localeDisplayNames/languages/language[@type="ak"] - tcLocale:true, locale calculated coverage:moderate

Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java

View workflow job for this annotation

GitHub Actions / build

(LikelySubtagsTest.java:371) Error: Language ee: fix coverageLevels.txt: Expected MODERN but got comprehensive for //ldml/localeDisplayNames/languages/language[@type="ee"] - tcLocale:true, locale calculated coverage:basic

Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java

View workflow job for this annotation

GitHub Actions / build

(LikelySubtagsTest.java:371) Error: Language gaa: fix coverageLevels.txt: Expected MODERN but got comprehensive for //ldml/localeDisplayNames/languages/language[@type="gaa"] - tcLocale:true, locale calculated coverage:basic

Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java

View workflow job for this annotation

GitHub Actions / build

(LikelySubtagsTest.java:371) Error: Language ii: fix coverageLevels.txt: Expected MODERN but got comprehensive for //ldml/localeDisplayNames/languages/language[@type="ii"] - tcLocale:false, locale calculated coverage:basic

Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java

View workflow job for this annotation

GitHub Actions / build

(LikelySubtagsTest.java:371) Error: Language nb: fix coverageLevels.txt: Expected MODERN but got comprehensive for //ldml/localeDisplayNames/languages/language[@type="nb"] - tcLocale:true, locale calculated coverage:modern

Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java

View workflow job for this annotation

GitHub Actions / build

(LikelySubtagsTest.java:371) Error: Language nso: fix coverageLevels.txt: Expected MODERN but got comprehensive for //ldml/localeDisplayNames/languages/language[@type="nso"] - tcLocale:true, locale calculated coverage:basic

Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java

View workflow job for this annotation

GitHub Actions / build

(LikelySubtagsTest.java:371) Error: Language om: fix coverageLevels.txt: Expected MODERN but got comprehensive for //ldml/localeDisplayNames/languages/language[@type="om"] - tcLocale:true, locale calculated coverage:basic

Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java

View workflow job for this annotation

GitHub Actions / build

(LikelySubtagsTest.java:371) Error: Language rw: fix coverageLevels.txt: Expected MODERN but got comprehensive for //ldml/localeDisplayNames/languages/language[@type="rw"] - tcLocale:true, locale calculated coverage:basic

Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java

View workflow job for this annotation

GitHub Actions / build

(LikelySubtagsTest.java:371) Error: Language st: fix coverageLevels.txt: Expected MODERN but got comprehensive for //ldml/localeDisplayNames/languages/language[@type="st"] - tcLocale:true, locale calculated coverage:basic

Check failure on line 371 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LikelySubtagsTest.java

View workflow job for this annotation

GitHub Actions / build

(LikelySubtagsTest.java:371) Error: Language tn: fix coverageLevels.txt: Expected MODERN but got comprehensive for //ldml/localeDisplayNames/languages/language[@type="tn"] - tcLocale:true, locale calculated coverage:basic
"Language "
+ language
+ ": fix coverageLevels.txt: Expected MODERN but got "
+ undCovLevel
+ " for "
+ path
+ " - tcLocale:"
+ isTcLocale
+ ", locale calculated coverage:"
+ langCovLevel);
}
}
}

Expand Down

0 comments on commit 1976c60

Please sign in to comment.