String bcpType = uext.getUnicodeLocaleType(bcpKey);
// convert to legacy key/type
String lkey = bcp47ToLDMLKey(bcpKey);
- String ltype = bcp47ToLDMLType(lkey, ((bcpType.length() == 0) ? "true" : bcpType)); // use "true" as the value of typeless keywords
+ String ltype = bcp47ToLDMLType(lkey, ((bcpType.length() == 0) ? "yes" : bcpType)); // use "yes" as the value of typeless keywords
// special handling for u-va-posix, since this is a variant, not a keyword
if (lkey.equals("va") && ltype.equals("posix") && base.getVariant().length() == 0) {
id = id + "_POSIX";
if (kwKey.length() != 1) {
// Unicode locale key
kwKey = bcp47ToLDMLKey(kwKey);
- // use "true" as the value of typeless keywords
- kwVal = bcp47ToLDMLType(kwKey, ((kwVal.length() == 0) ? "true" : kwVal));
+ // use "yes" as the value of typeless keywords
+ kwVal = bcp47ToLDMLType(kwKey, ((kwVal.length() == 0) ? "yes" : kwVal));
}
if (addSep) {
/*
*******************************************************************************
- * Copyright (C) 2009-2010, International Business Machines Corporation and *
+ * Copyright (C) 2009-2012, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
{"E", "z", "ExtZ", "L", "en", "E", "z", null, "T", "en", "en"},
{"E", "a", "x", "X"},
{"E", "a", "abc_def", "T", "und-a-abc-def", "@a=abc-def"},
- {"L", "en", "E", "u", "bbb-aaa-00", "T", "en-u-aaa-bbb-00-true", "en@00=true;attribute=aaa-bbb"},
+ // Design limitation - typeless u extension keyword 00 below is interpreted as a boolean value true/yes.
+ // With the legacy keyword syntax, "yes" is used for such boolean value instead of "true".
+ // However, once the legacy keyword is translated back to BCP 47 u extension, key "00" is unknown,
+ // so "yes" is preserved - not mapped to "true". We could change the code to automatically transform
+ // "yes" to "true", but it will break roundtrip conversion if BCP 47 u extension has "00-yes".
+ {"L", "en", "E", "u", "bbb-aaa-00", "T", "en-u-aaa-bbb-00-yes", "en@00=yes;attribute=aaa-bbb"},
{"L", "fr", "R", "FR", "P", "Yoshito-ICU", "T", "fr-FR-x-yoshito-icu", "fr_FR@x=yoshito-icu"},
{"L", "ja", "R", "jp", "K", "ca", "japanese", "T", "ja-JP-u-ca-japanese", "ja_JP@calendar=japanese"},
{"K", "co", "PHONEBK", "K", "ca", "gregory", "L", "De", "T", "de-u-ca-gregory-co-phonebk", "de@calendar=gregorian;collation=phonebook"},
{"ar-x-1-2-3", "ar@x=1-2-3", NOERROR},
{"fr-u-nu-latn-cu-eur", "fr@currency=eur;numbers=latn", NOERROR},
{"de-k-kext-u-co-phonebk-nu-latn", "de@collation=phonebook;k=kext;numbers=latn", NOERROR},
- {"ja-u-cu-jpy-ca-jp", "ja@calendar=true;currency=jpy;jp=true", NOERROR},
+ {"ja-u-cu-jpy-ca-jp", "ja@calendar=yes;currency=jpy;jp=yes", NOERROR},
{"en-us-u-tz-usnyc", "en_US@timezone=America/New_York", NOERROR},
{"und-a-abc-def", "@a=abc-def", NOERROR},
{"zh-u-ca-chinese-x-u-ca-chinese", "zh@calendar=chinese;x=u-ca-chinese", NOERROR},
{"fr--FR", "fr", Integer.valueOf(3)},
{"fr-", "fr", Integer.valueOf(3)},
{"x-elmer", "@x=elmer", NOERROR},
+ {"en-US-u-attr1-attr2-ca-gregory", "en_US@attribute=attr1-attr2;calendar=gregorian", NOERROR},
+ {"sr-u-kn", "sr@colnumeric=yes", NOERROR},
+ {"de-u-kn-co-phonebk", "de@collation=phonebook;colnumeric=yes", NOERROR},
+ {"en-u-attr2-attr1-kn-kb", "en@attribute=attr1-attr2;colbackwards=yes;colnumeric=yes", NOERROR},
+ {"ja-u-ijkl-efgh-abcd-ca-japanese-xx-yyy-zzz-kn", "ja@attribute=abcd-efgh-ijkl;calendar=japanese;colnumeric=yes;xx=yyy-zzz", NOERROR},
+
+ {"de-u-xc-xphonebk-co-phonebk-ca-buddhist-mo-very-lo-extensi-xd-that-de-should-vc-probably-xz-killthebuffer",
+ "de@calendar=buddhist;collation=phonebook;de=should;lo=extensi;mo=very;vc=probably;xc=xphonebk;xd=that;xz=yes", Integer.valueOf(92)},
+
};
for (int i = 0; i < langtag_to_locale.length; i++) {