use of com.ibm.icu.text.Collator in project es6draft by anba.
the class IntlDataTools method collationCase.
static void collationCase(Path cldr) throws IOException {
Files.walk(cldr.resolve("collation")).filter(Files::isRegularFile).forEach(p -> {
try (Reader reader = Files.newBufferedReader(p, StandardCharsets.UTF_8)) {
Document document = document(reader);
elementsByTagName(document, "collation").filter(e -> "standard".equals(e.getAttribute("type"))).forEach(e -> {
elementByTagName(e, "cr").ifPresent(cr -> {
String text = cr.getTextContent();
if (text.contains("caseFirst")) {
System.out.println(p.getFileName());
}
});
});
} catch (IOException e) {
throw new UncheckedIOException(e);
}
});
for (ULocale locale : Collator.getAvailableULocales()) {
Collator collator = Collator.getInstance(locale);
if (collator instanceof RuleBasedCollator) {
RuleBasedCollator ruleBasedCollator = (RuleBasedCollator) collator;
if (ruleBasedCollator.isUpperCaseFirst()) {
System.out.printf("upper-first = %s%n", locale);
} else if (ruleBasedCollator.isLowerCaseFirst()) {
System.out.printf("lower-first = %s%n", locale);
}
}
}
}
Aggregations