From 1516aa224af6354431c6b65e9fd879e27c600c95 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Wed, 31 Jul 2024 14:03:27 -0500 Subject: [PATCH] CLDR-17857 add a whole-locale warning for missing English name. - warning, not error, otherwise we'd block builds! - new subtype missingEnglishName --- .../java/org/unicode/cldr/test/CheckCLDR.java | 3 ++- .../org/unicode/cldr/test/CheckCoverage.java | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java index 2c8fd1540ad..96d6a049c3b 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java @@ -936,7 +936,8 @@ public enum Subtype { shortDateFieldInconsistentLength, illegalParameterValue, illegalAnnotationCode, - illegalCharacter; + illegalCharacter, + missingEnglishName; @Override public String toString() { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCoverage.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCoverage.java index 0e5e8ea96da..06088e7d1e1 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCoverage.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCoverage.java @@ -10,6 +10,7 @@ import org.unicode.cldr.test.CheckCLDR.CheckStatus.Subtype; import org.unicode.cldr.util.CLDRFile; import org.unicode.cldr.util.CLDRFile.Status; +import org.unicode.cldr.util.CLDRLocale; import org.unicode.cldr.util.Factory; import org.unicode.cldr.util.InternalCldrException; import org.unicode.cldr.util.LanguageTagParser; @@ -157,6 +158,25 @@ public CheckCLDR handleSetCldrFileToCheck( setSkipTest(false); latin = ValuePathStatus.isLatinScriptLocale(cldrFileToCheck); + // check whether the English name is present. See {@link + // LikelySubtagsTest#TestMissingInfoForLanguage} + { + final CLDRLocale locale = CLDRLocale.getInstance(localeID); + String path = CLDRFile.getKey(CLDRFile.LANGUAGE_NAME, locale.getLanguage()); + // getEnglishFile() returns a resolved file, so just check isHere. + boolean englishName = getEnglishFile().isHere(path); + if (!englishName) { + possibleErrors.add( + new CheckStatus() + .setCause(this) + .setMainType(CheckStatus.warningType) + .setSubtype(Subtype.missingEnglishName) + .setMessage( + "Missing English translation for " + locale.getLanguage(), + new Object[] {})); + } + } + return this; }