"Deutschland",
"Thailand",
"",
- "United States",
- "Spain",
- "Germany",
- "Thailand",
+ "US",
+ "ES",
+ "DE",
+ "TH",
};
String[] expectedWithoutRegionData = {
"",
"en",
"es",
"de",
- "und",
+ "",
"",
"English",
"Spanish",
"German",
- "Unknown Language",
+ "",
"",
"ingl\u00E9s",
"espa\u00F1ol",
"alem\u00E1n",
- "lengua desconocida",
+ "",
"",
"Englisch",
"Spanisch",
"Deutsch",
- "Unbestimmte Sprache",
"",
- "English",
- "Spanish",
- "German",
- "Unknown Language",
+ "",
+ "en",
+ "es",
+ "de",
+ "",
};
String[] expectedWithoutLanguageData = {
"",
"en",
"es",
"de",
- "und"
+ "",
};
String[] expected = LocaleDisplayNamesImpl.haveData(LANG) ?
expectedWithLanguageData : expectedWithoutLanguageData;
for (Locale displayJavaLocale : javaLocales) {
LocaleDisplayNames dn = LocaleDisplayNames.getInstance(displayJavaLocale);
for (Locale targetLocale : javaLocales) {
- String result = dn.languageDisplayName(targetLocale.getLanguage());
- assertEquals(targetLocale + " in " + displayJavaLocale, expected[n++], result);
- if (n == expected.length) {
+ // ICU-20273: ICU and Java handle "und" differently, skip those test cases.
+ if (!"und".equals(targetLocale.getLanguage())) {
+ String result = dn.languageDisplayName(targetLocale.getLanguage());
+ assertEquals(targetLocale + " in " + displayJavaLocale, expected[n], result);
+ }
+ if (++n == expected.length) {
n = 0;
}
}
@Test
public void testLocaleDisplayNameWithKeywords() {
String[] expectedWithLanguageData = {
- "root (collation=phonebook)",
- "Root (Phonebook Sort Order)",
- "ra\u00EDz (orden de list\u00EDn telef\u00F3nico)",
- "Root (Telefonbuch-Sortierung)",
- "Root (Phonebook Sort Order)",
+ "und (collation=phonebook)",
+ "Unknown language (Phonebook Sort Order)",
+ "lengua desconocida (orden de list\u00EDn telef\u00F3nico)",
+ "Unbekannte Sprache (Telefonbuch-Sortierung)",
+ "und (collation=phonebook)",
};
String[] expectedWithoutLanguageData = {
- "root (collation=phonebook)",
+ "und (collation=phonebook)",
};
String[] expected = LocaleDisplayNamesImpl.haveData(LANG) ?
expectedWithLanguageData : expectedWithoutLanguageData;