/* lookup should run without throwing any exception and *returnnullasthelanguagerangedoesnotmatchwiththelanguage *tag
*/
List<LanguageRange> ranges = LanguageRange.parse("nv");
Collection<Locale> locales = Collections.singleton(Locale.ENGLISH);
try {
Locale match = Locale.lookup(ranges, locales); if (match != null) { thrownew RuntimeException("Locale.lookup returned non-null: "
+ match);
}
} catch (Exception ex) { thrownew RuntimeException("[Locale.lookup failed on language"
+ " range: " + ranges + " and language tags "
+ locales + "]", ex);
}
/* lookup should run without throwing any exception and *return"nv"asthematchingtag
*/
ranges = LanguageRange.parse("i-navajo");
locales = Collections.singleton(Locale.of("nv"));
try {
Locale match = Locale.lookup(ranges, locales); if (!match.toLanguageTag().equals("nv")) { thrownew RuntimeException("Locale.lookup returned unexpected"
+ " result: " + match);
}
} catch (Exception ex) { thrownew RuntimeException("[Locale.lookup failed on language"
+ " range: " + ranges + " and language tags "
+ locales + "]", ex);
}
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.