mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-4229 Check for that zzzz is treated as duplicate of "others"; only allow regular scripts + zzzz.
X-SVN-Rev: 38138
This commit is contained in:
parent
ddfb23cc4c
commit
1d5b1fbb6f
2 changed files with 8 additions and 3 deletions
|
@ -181,7 +181,7 @@ public class LocaleValidityChecker {
|
|||
}
|
||||
continue;
|
||||
case reorder:
|
||||
boolean newlyAdded = seen.add(subtag);
|
||||
boolean newlyAdded = seen.add(subtag.equals("zzzz") ? "others" : subtag);
|
||||
if (!newlyAdded || !isScriptReorder(subtag)) {
|
||||
return where.set(Datatype.u, key+"-"+subtag);
|
||||
}
|
||||
|
@ -236,8 +236,9 @@ public class LocaleValidityChecker {
|
|||
return true;
|
||||
}
|
||||
|
||||
static final Set<String> REORDERING_INCLUDE = new HashSet<String>(Arrays.asList("space", "punct", "symbol", "currency", "digit", "others"));
|
||||
static final Set<String> REORDERING_INCLUDE = new HashSet<String>(Arrays.asList("space", "punct", "symbol", "currency", "digit", "others", "zzzz"));
|
||||
static final Set<String> REORDERING_EXCLUDE = new HashSet<String>(Arrays.asList("zinh", "zyyy"));
|
||||
static final Set<Datasubtype> REGULAR_ONLY = EnumSet.of(Datasubtype.regular);
|
||||
/**
|
||||
* @param subtag
|
||||
* @return
|
||||
|
@ -249,7 +250,7 @@ public class LocaleValidityChecker {
|
|||
} else if (REORDERING_EXCLUDE.contains(subtag)) {
|
||||
return false;
|
||||
}
|
||||
return ValidIdentifiers.isValid(Datatype.script, datasubtypes, subtag) != null;
|
||||
return ValidIdentifiers.isValid(Datatype.script, REGULAR_ONLY, subtag) != null;
|
||||
// space, punct, symbol, currency, digit - core groups of characters below 'a'
|
||||
// any script code except Common and Inherited.
|
||||
// sc ; Zinh ; Inherited ; Qaai
|
||||
|
|
|
@ -64,6 +64,7 @@ public class TestLocaleValidity extends TestFmwk {
|
|||
{"OK", "en-u-kk-false"},
|
||||
{"OK", "en-u-kn-false"},
|
||||
{"OK", "en-u-kr-latn-digit-symbol"}, // reorder codes, multiple
|
||||
{"OK", "en-u-kr-latn-digit-others-Cyrl"}, // reorder codes, duplicat
|
||||
{"OK", "en-u-ks-identic"},
|
||||
{"OK", "en-u-kv-currency"},
|
||||
{"OK", "en-u-nu-ahom"},
|
||||
|
@ -121,6 +122,9 @@ public class TestLocaleValidity extends TestFmwk {
|
|||
{"{u, kn-falsx}", "en-u-kn-falsx"},
|
||||
{"{u, kr-symbox}", "en-u-kr-latn-digit-symbox"}, // reorder codes, multiple
|
||||
{"{u, kr-latn}", "en-u-kr-latn-digit-latn"}, // reorder codes, duplicat
|
||||
{"{u, kr-zzzz}", "en-u-kr-latn-others-digit-Zzzz"}, // reorder codes, duplicat
|
||||
{"{u, kr-zsym}", "en-u-kr-Zsym"}, // reorder codes, duplicat
|
||||
{"{u, kr-qaai}", "en-u-kr-Qaai"}, // reorder codes, duplicat
|
||||
{"{u, ks-identix}", "en-u-ks-identix"},
|
||||
{"{u, kv-currencx}", "en-u-kv-currencx"},
|
||||
{"{u, nu-ahox}", "en-u-nu-ahox"},
|
||||
|
|
Loading…
Add table
Reference in a new issue