Skip to content

Commit

Permalink
CLDR-17857 add a whole-locale warning for missing English name.
Browse files Browse the repository at this point in the history
- warning, not error, otherwise we'd block builds!
- new subtype missingEnglishName
  • Loading branch information
srl295 committed Jul 31, 2024
1 parent 951ebdf commit 1516aa2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,8 @@ public enum Subtype {
shortDateFieldInconsistentLength,
illegalParameterValue,
illegalAnnotationCode,
illegalCharacter;
illegalCharacter,
missingEnglishName;

@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 1516aa2

Please sign in to comment.