Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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 @@
} 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 @@
}
errln("Missing English translation for: " + language + " which is at " + covLevel);
}
// now, check general coverage level. Use "und" so it is neutral.
Copy link
Member

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.

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 Expand Up @@ -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

View workflow job for this annotation

GitHub Actions / build

(LikelySubtagsTest.java:581) Warning: Locales have 214 unexpected characters in main and/or aux: [҂״܀-܍०-९৲-৺੦-੯૰౦-౯໐-໙၀-၉၏႐-႙႞႟፠-፼᎐-᎙᠐-᠙꒐-꓆𞅏{a\:}{ch’}{e\:}{i\:}{k’}{o\:}{ts’}{tł’}{t’}{à\:}{á\:}{è\:}{é\:}{ì\:}{í\:}{ò\:}{ó\:}{ଅ\:}{ଆ\:}{ଏ\:}]
"Locales have "
+ collectedBad.size()
+ " unexpected characters in main and/or aux:\t"
Expand Down Expand Up @@ -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());

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

View workflow job for this annotation

GitHub Actions / build

(LikelySubtagsTest.java:815) Warning: Bad status=macroregion for [001, 419]
}
}
}
Expand Down
Loading