ICU-9577 CompactDecimalFormat to fallback to short form when long form is not available.

X-SVN-Rev: 32386
This commit is contained in:
Travis Keep 2012-09-14 18:41:29 +00:00
parent 3e9e1901db
commit afbf770237
2 changed files with 10 additions and 0 deletions

View File

@ -136,6 +136,9 @@ class CompactDecimalDataCache {
} else {
r = r.getWithFallback(resourcePath);
}
if (r == null) {
return null;
}
int size = r.getSize();
Data result = new Data(
new long[MAX_DIGITS],

View File

@ -109,6 +109,13 @@ public class CompactDecimalFormatTest extends TestFmwk {
checkLocale(ULocale.ENGLISH, CompactStyle.SHORT, EnglishTestData);
}
public void TestNoLongStyleInCLDR() {
NumberFormat cdf =
NumberFormat.getCompactDecimalInstance(
ULocale.forLanguageTag("ar_EG"), CompactStyle.LONG);
assertEquals("Missing PatternsLong", "5K", cdf.format(5000));
}
public void TestSerbianShort() {
checkLocale(ULocale.forLanguageTag("sr"), CompactStyle.SHORT, SerbianTestDataShort);
}