mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-12948 Handle new KeyType values, codes
X-SVN-Rev: 39595
This commit is contained in:
parent
47e1aaaf14
commit
8e2a943ae8
1 changed files with 17 additions and 2 deletions
|
@ -30,7 +30,7 @@ import com.ibm.icu.util.UResourceBundleIterator;
|
|||
public class KeyTypeData {
|
||||
|
||||
public enum ValueType {
|
||||
single, multiple, incremental, any
|
||||
single, multiple, incremental, languageTag, any
|
||||
}
|
||||
|
||||
private static abstract class SpecialTypeHandler {
|
||||
|
@ -48,6 +48,14 @@ public class KeyTypeData {
|
|||
}
|
||||
}
|
||||
|
||||
private static class LanguageTagTypeHandler extends SpecialTypeHandler {
|
||||
private static final Pattern pat = Pattern.compile("[a-zA-Z]{3,8}");
|
||||
@Override
|
||||
boolean isWellFormed(String value) {
|
||||
return pat.matcher(value).matches();
|
||||
}
|
||||
}
|
||||
|
||||
private static class ReorderCodeTypeHandler extends SpecialTypeHandler {
|
||||
private static final Pattern pat = Pattern.compile("[a-zA-Z]{3,8}(-[a-zA-Z]{3,8})*");
|
||||
@Override
|
||||
|
@ -82,6 +90,7 @@ public class KeyTypeData {
|
|||
|
||||
private enum SpecialType {
|
||||
CODEPOINTS(new CodepointsTypeHandler()),
|
||||
LANGUAGE_TAG(new LanguageTagTypeHandler()),
|
||||
REORDER_CODE(new ReorderCodeTypeHandler()),
|
||||
RG_KEY_VALUE(new RgKeyValueTypeHandler()),
|
||||
SUBDIVISION_CODE(new SubdivisionKeyValueTypeHandler()),
|
||||
|
@ -411,6 +420,8 @@ keyInfo{
|
|||
}
|
||||
valueType{
|
||||
ca{"incremental"}
|
||||
h0{"language-tag"}
|
||||
h1{"language-tag"}
|
||||
kr{"multiple"}
|
||||
vt{"multiple"}
|
||||
x0{"any"}
|
||||
|
@ -433,7 +444,11 @@ keyInfo{
|
|||
_deprecatedKeys.add(key2);
|
||||
break;
|
||||
case valueType:
|
||||
_valueTypes.put(key2, ValueType.valueOf(value2));
|
||||
if (value2.equals("language-tag")) {
|
||||
_valueTypes.put(key2, ValueType.languageTag);
|
||||
} else {
|
||||
_valueTypes.put(key2, ValueType.valueOf(value2));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue