ICU-8082 private collation type: do not list as an available keyword value

X-SVN-Rev: 36012
This commit is contained in:
Markus Scherer 2014-07-08 20:58:58 +00:00
parent 2e958e2bab
commit 38b83477bf
5 changed files with 17 additions and 12 deletions
icu4j/main
classes
collate/src/com/ibm/icu/text
core/src/com/ibm/icu/impl
shared/data
tests/collate/src/com/ibm/icu/dev/test/collator

View file

@ -994,7 +994,7 @@ public abstract class Collator implements Comparator<Object>, Freezable<Collator
// Keep the default
defcoll = collations.getString("default");
}
} else if (!values.contains(collkey)) {
} else if (!collkey.startsWith("private-") && !values.contains(collkey)) {
values.add(collkey);
}
}

View file

@ -323,8 +323,8 @@ public class ICUResourceBundle extends UResourceBundle {
Enumeration<String> e = irb.getKeys();
while (e.hasMoreElements()) {
String s = e.nextElement();
if (!DEFAULT_TAG.equals(s)) {
// don't add 'default' items
if (!DEFAULT_TAG.equals(s) && !s.startsWith("private-")) {
// don't add 'default' items, nor unlisted types
keywords.add(s);
}
}

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ba61a15f14acdc6a323524db85c2e5990dc15b20c04fcb170bbb9a5517864099
size 10503185
oid sha256:df42e127c7c6127bce3a0a44577d33d8457fc073f5fa131f6916c039b374932c
size 10503267

View file

@ -2194,7 +2194,12 @@ public class CollationMiscTest extends TestFmwk {
log(values[i]+", ");
}
logln("");
logln("Number of collator values returned : " + values.length);
logln("Number of collation keyword values returned : " + values.length);
for(int i=0; i<values.length;i++){
if (values[i].startsWith("private-")) {
errln("Collator.getKeywordValues() returns private collation keyword: " + values[i]);
}
}
Set foundValues = new TreeSet(Arrays.asList(values));

View file

@ -950,13 +950,13 @@ public class CollationTest extends TestFmwk {
for (; locIdx < locales.length; localeID = locales[locIdx++].getName()) {
ULocale locale = new ULocale(localeID);
String[] types = Collator.getKeywordValuesForLocale("collation", locale, false);
String type = null; // default type
int typeIdx = 0;
for (; typeIdx < types.length; type = types[typeIdx++]) {
ULocale localeWithType = locale;
if (type != null) {
localeWithType = localeWithType.setKeywordValue("collation", type);
for (int typeIdx = 0; typeIdx < types.length; ++typeIdx) {
String type = types[typeIdx]; // first: default type
if (type.startsWith("private-")) {
errln("Collator.getKeywordValuesForLocale(" + localeID +
") returns private collation keyword: " + type);
}
ULocale localeWithType = locale.setKeywordValue("collation", type);
Collator coll = Collator.getInstance(localeWithType);
ULocale actual = coll.getLocale(ULocale.ACTUAL_LOCALE);
if (prevLocales.contains(actual.getName())) {