// Deprecated and Legacy tags. // As of CLDR 38, language aliases for some of the legacy tags have been removed. privatestaticfinal Set<String> LegacyAliases = Set.of( "zh-guoyu", "zh-min-nan", "i-klingon", "i-tsu", "sgn-CH-DE", "mo", "i-tay", "scc", "i-hak", "sgn-BE-FR", "i-lux", "tl", "zh-hakka", "i-ami", "aa-SAAHO", "zh-xiang", "i-pwn", "sgn-BE-NL", "jw", "sh", "i-bnn"); // expected month format data for locales after language aliases replacement. privatestaticfinal Map<String, String> shortJanuaryNames = Map.of( "pa-PK", "\u0a1c\u0a28", "uz-AF" , "yan", "sr-ME", "\u0458\u0430\u043d", "scc", "\u0458\u0430\u043d", "sh", "jan", "ha-Latn-NE", "Jan", "i-lux", "Jan.");
privatestaticvoid test(String tag, String expected) {
Locale target = Locale.forLanguageTag(tag);
Month day = Month.JANUARY;
TextStyle style = TextStyle.SHORT;
String actual = day.getDisplayName(style, target); if (!actual.equals(expected)) { thrownew RuntimeException("failed for locale " + tag + " actual output " + actual +" does not match with " + expected);
}
}
/** *getAvailableLocales()shouldnotcontainanydeprecatedorLegacylanguagetags
*/ privatestaticvoid checkInvalidTags() {
Set<String> invalidTags = new HashSet<>();
Arrays.asList(Locale.getAvailableLocales()).stream()
.map(loc -> loc.toLanguageTag())
.forEach( tag -> {if(LegacyAliases.contains(tag)) {invalidTags.add(tag);}}); if (!invalidTags.isEmpty()) { thrownew RuntimeException("failed: Deprecated and Legacy tags found " + invalidTags + " in AvailableLocales ");
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.