/*
*******************************************************************************
- * Copyright (C) 2008-2010, International Business Machines Corporation and *
+ * Copyright (C) 2008-2012, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
continue;
}
+ // Note: Short term workaround for Java locale with script.
+ // Java Locale with non-empty script cannot have variant "ICU"
+ // because it's not well-formed as BCP 47. Because we cannot
+ // build such Locale, we skip the check below for now.
+ boolean ignoreErrorForNow = TestUtil.hasScript(loc);
+
if (TestUtil.isICUExtendedLocale(loc)) {
if (!curSymbol.equals(curSymbolIcu)) {
- if (!curSymbol.equals(curSymbolIcu)) {
+ if (!curSymbol.equals(curSymbolIcu) && !ignoreErrorForNow) {
errln("FAIL: Currency symbol for " + currencyCode + " by ICU is " + curSymbolIcu
+ ", but got " + curSymbol + " in locale " + loc);
}
// Try explicit ICU locale (xx_yy_ICU)
Locale locIcu = TestUtil.toICUExtendedLocale(loc);
curSymbol = currency.getSymbol(locIcu);
- if (!curSymbol.equals(curSymbolIcu)) {
+ if (!curSymbol.equals(curSymbolIcu) && !ignoreErrorForNow) {
errln("FAIL: Currency symbol for " + currencyCode + " by ICU is " + curSymbolIcu
+ ", but got " + curSymbol + " in locale " + locIcu);
}
/*
*******************************************************************************
- * Copyright (C) 2008, International Business Machines Corporation and *
+ * Copyright (C) 2008-2012, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
}
String name = forLocale.getDisplayLanguage(inLocale);
+
+ // Note: Short term workaround for Java locale with script.
+ // Java Locale with non-empty script cannot have variant "ICU"
+ // because it's not well-formed as BCP 47. Because we cannot
+ // build such Locale, we skip the check below for now.
+ boolean ignoreErrorForNow = TestUtil.hasScript(inLocale);
+
if (TestUtil.isICUExtendedLocale(inLocale)) {
// The name should be taken from ICU
- if (!name.equals(icuname)) {
+ if (!name.equals(icuname) && !ignoreErrorForNow) {
errln("FAIL: Language name by ICU is " + icuname + ", but got " + name
+ " for locale " + forLocale + " in locale " + inLocale);
}
}
// Try explicit ICU locale (xx_yy_ICU)
name = forLocale.getDisplayLanguage(inLocaleICU);
- if (!name.equals(icuname)) {
+ if (!name.equals(icuname) && !ignoreErrorForNow) {
errln("FAIL: Language name by ICU is " + icuname + ", but got " + name
+ " for locale " + forLocale + " in locale " + inLocaleICU);
}
/*
*******************************************************************************
- * Copyright (C) 2008-2009, International Business Machines Corporation and *
+ * Copyright (C) 2008-2012, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
import java.util.Locale;
+import com.ibm.icu.util.ULocale;
+
public class TestUtil {
private static final String ICU_VARIANT = "ICU";
}
return false;
}
+
+ /**
+ * Check if the given Locale has script field (Java 7+)
+ * @param locale the locale
+ * @return true if the given Locale has non-empty script
+ */
+ public static boolean hasScript(Locale locale) {
+ ULocale uloc = ULocale.forLocale(locale);
+ return uloc.getScript().length() > 0;
+ }
}
/*
*******************************************************************************
- * Copyright (C) 2008-2010, International Business Machines Corporation and *
+ * Copyright (C) 2008-2012, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
String styleStr = (style == TimeZone.SHORT) ? "SHORT" : "LONG";
String name = tz.getDisplayName(daylight, style, loc);
+
+ // Note: Short term workaround for Java locale with script.
+ // Java Locale with non-empty script cannot have variant "ICU"
+ // because it's not well-formed as BCP 47. Because we cannot
+ // build such Locale, we skip the check below for now.
+ boolean ignoreErrorForNow = TestUtil.hasScript(loc);
+
if (TestUtil.isICUExtendedLocale(loc)) {
// The name should be taken from ICU
if (!name.equals(icuname)) {
- if (warnOnly) {
+ if (warnOnly || ignoreErrorForNow) {
logln("WARNING: TimeZone name by ICU is " + icuname + ", but got " + name
+ " for time zone " + tz.getID() + " in locale " + loc
+ " (daylight=" + daylight + ", style=" + styleStr + ")");
Locale icuLoc = TestUtil.toICUExtendedLocale(loc);
name = tz.getDisplayName(daylight, style, icuLoc);
if (!name.equals(icuname)) {
- if (warnOnly) {
+ if (warnOnly || ignoreErrorForNow) {
logln("WARNING: TimeZone name by ICU is " + icuname + ", but got " + name
+ " for time zone " + tz.getID() + " in locale " + icuLoc
+ " (daylight=" + daylight + ", style=" + styleStr + ")");