ICU-9785 Imported ICU data including updated Thai punctuation exemplar data. Also fixed ES_CURRENCY and some documentation / API version tag issues.

X-SVN-Rev: 32952
This commit is contained in:
Yoshito Umaoka 2012-12-13 19:52:57 +00:00
parent 7d87cf7598
commit 612181f2f5
3 changed files with 59 additions and 7 deletions

View File

@ -45,13 +45,14 @@ public final class LocaleData {
/**
* EXType for {@link #getExemplarSet(int, int)}.
* @stable ICU 3.4
* @stable ICU 4.4
*/
public static final int ES_INDEX = 2;
/**
* EXType for {@link #getExemplarSet(int, int)}.
* @stable ICU 3.4
* Note: This type is no longer supported.
* @stable ICU 4.4
*/
public static final int ES_CURRENCY = 3;
@ -156,7 +157,7 @@ public final class LocaleData {
* IGNORE_SPACE bit is always set, regardless of the
* value of 'options'.
* @param extype The type of exemplar set to be retrieved,
* ES_STANDARD, ES_INDEX, ES_CURRENCY, or ES_AUXILIARY
* ES_STANDARD, ES_INDEX, ES_AUXILIARY, or ES_PUNCTUATION
* @return The set of exemplar characters for the given locale.
* @stable ICU 3.4
*/
@ -167,6 +168,11 @@ public final class LocaleData {
"ExemplarCharactersPunctuation"
};
if (extype == ES_CURRENCY) {
// currency symbol exemplar is no longer available
return new UnicodeSet();
}
try{
ICUResourceBundle stringBundle = (ICUResourceBundle) bundle.get(exemplarSetTypes[extype]);
@ -195,7 +201,7 @@ public final class LocaleData {
}
}
static final Pattern US_SYNTAX = Pattern.compile(" ([\\-\\&\\{\\}\\[\\]])");
static final Pattern US_SYNTAX = Pattern.compile(" ([\\-\\&\\{\\}\\[\\]\\\\])");
/**
* Gets the LocaleData object associated with the ULocale specified in locale

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:63d4a9c78178ab0295f34472d1313c2da18d4fbc8ab33dbe41b3c892258dacd6
size 9757986
oid sha256:8664ebd2785120b69a629e2a3bcb65621037f9caa17b2d2bf9130fc616b01410
size 9758007

View File

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2003-2010, International Business Machines Corporation and *
* Copyright (C) 2003-2012, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -275,6 +275,52 @@ public class LocaleDataTest extends TestFmwk{
assertTrue("case-folded is sometimes a strict superset, and sometimes equal",
equalCount > 0 && equalCount < availableLocales.length * 2);
}
// Test case created for checking type coverage of static getExemplarSet method.
// See #9785, #9794 and #9795
public void TestExemplarSetTypes() {
final String[] testLocales = {
"am", // No auxiliary / index exemplars as of ICU 50
"en",
"th", // #9785
"foo", // Bogus locale
};
final int[] testTypes = {
LocaleData.ES_STANDARD,
LocaleData.ES_AUXILIARY,
LocaleData.ES_INDEX,
LocaleData.ES_CURRENCY,
LocaleData.ES_PUNCTUATION,
};
final String[] testTypeNames = {
"ES_STANDARD",
"ES_AUXILIARY",
"ES_INDEX",
"ES_CURRENCY",
"ES_PUNCTUATION",
};
for (String locstr : testLocales) {
ULocale loc = new ULocale(locstr);
for (int i = 0; i < testTypes.length; i++) {
try {
UnicodeSet set = LocaleData.getExemplarSet(loc, 0, testTypes[i]);
if (set == null) {
// Not sure null is really OK (#9795)
logln(loc + "(" + testTypeNames[i] + ") returned null");
} else if (set.isEmpty()) {
// This is probably reasonable when data is absent
logln(loc + "(" + testTypeNames[i] + ") returned an empty set");
}
} catch (Exception e) {
errln(loc + "(" + testTypeNames[i] + ") Exception:" + e.getMessage());
}
}
}
}
public void TestCoverage(){
LocaleData ld = LocaleData.getInstance();
boolean t = ld.getNoSubstitute();