mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-4229 Check for duplicate reorder codes
X-SVN-Rev: 38132
This commit is contained in:
parent
0b2778f3bb
commit
c3d49f32fc
2 changed files with 10 additions and 1 deletions
|
@ -131,6 +131,7 @@ public class LocaleValidityChecker {
|
|||
ValueType valueType = null;
|
||||
SpecialCase specialCase = null;
|
||||
StringBuilder prefix = new StringBuilder();
|
||||
Set<String> seen = new HashSet<String>();
|
||||
// TODO: is empty -u- valid?
|
||||
for (String subtag : SEPARATOR.split(extensionString)) {
|
||||
if (subtag.length() == 2) {
|
||||
|
@ -160,6 +161,12 @@ public class LocaleValidityChecker {
|
|||
prefix.append('-').append(subtag);
|
||||
subtag = prefix.toString();
|
||||
}
|
||||
break;
|
||||
case multiple:
|
||||
if (typeCount == 1) {
|
||||
seen.clear();
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (specialCase) {
|
||||
case anything:
|
||||
|
@ -174,7 +181,8 @@ public class LocaleValidityChecker {
|
|||
}
|
||||
continue;
|
||||
case reorder:
|
||||
if (!isScriptReorder(subtag)) {
|
||||
boolean newlyAdded = seen.add(subtag);
|
||||
if (!newlyAdded || !isScriptReorder(subtag)) {
|
||||
return where.set(Datatype.u, key+"-"+subtag);
|
||||
}
|
||||
continue;
|
||||
|
|
|
@ -120,6 +120,7 @@ public class TestLocaleValidity extends TestFmwk {
|
|||
{"{u, kk-falsx}", "en-u-kk-falsx"},
|
||||
{"{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, 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