ICU-8951 Minor updates including additional test cases.

X-SVN-Rev: 36316
This commit is contained in:
Yoshito Umaoka 2014-09-02 23:41:52 +00:00
parent 1b8eb15e1a
commit 9e14f0bb18
2 changed files with 12 additions and 4 deletions

View File

@ -3292,12 +3292,12 @@ public final class ULocale implements Serializable, Comparable<ULocale> {
* @provisional This API might change or be removed in a future release.
*/
public static String toUnicodeLocaleKey(String keyword) {
String uniLocKey = KeyTypeData.toBcpKey(keyword);
if (uniLocKey == null && UnicodeLocaleExtension.isKey(keyword)) {
String bcpKey = KeyTypeData.toBcpKey(keyword);
if (bcpKey == null && UnicodeLocaleExtension.isKey(keyword)) {
// unknown keyword, but syntax is fine..
uniLocKey = AsciiUtil.toLowerString(keyword);
bcpKey = AsciiUtil.toLowerString(keyword);
}
return uniLocKey;
return bcpKey;
}
/**

View File

@ -4508,6 +4508,10 @@ public class ULocaleTest extends TestFmwk {
{"ca", "gregory-japanese-islamic", "gregory-japanese-islamic"}, // unknown type, well-formed type
{"zz", "gregorian", null}, // unknown key, ill-formed type
{"co", "foo-", null}, // unknown type, ill-formed type
{"variableTop", "00A0", "00a0"}, // valid codepoints type
{"variableTop", "wxyz", "wxyz"}, // invalid codepoints type - return as is for now
{"kr", "space-punct", "space-punct"}, // valid reordercode type
{"kr", "digit-spacepunct", null}, // invalid reordercode type
};
for (String[] d : DATA) {
@ -4542,6 +4546,10 @@ public class ULocaleTest extends TestFmwk {
{"zz", "gregorian", "gregorian"}, // unknown key, bcp ill-formed type
{"ca", "gregorian-calendar", "gregorian-calendar"}, // known key, bcp ill-formed type
{"co", "e=mc2", null}, // known key, ill-formed bcp/legacy type
{"variableTop", "00A0", "00a0"}, // valid codepoints type
{"variableTop", "wxyz", "wxyz"}, // invalid codepoints type - return as is for now
{"kr", "space-punct", "space-punct"}, // valid reordercode type
{"kr", "digit-spacepunct", "digit-spacepunct"}, // invalid reordercode type, bad ok for legacy syntax
};
for (String[] d : DATA) {