ICU-9612 Let 0 in CLDR data mean format number normally with no prefix or suffix.
X-SVN-Rev: 32453
This commit is contained in:
parent
df0d824956
commit
841c0b626a
@ -268,10 +268,19 @@ class CompactDecimalDataCache {
|
||||
"' for variant '" +pluralVariant + "' for 10^" + idx +
|
||||
" in " + localeAndStyle(locale, style));
|
||||
}
|
||||
String prefix = fixQuotes(template.substring(0, firstIdx));
|
||||
String suffix = fixQuotes(template.substring(lastIdx + 1));
|
||||
savePrefixOrSuffix(
|
||||
fixQuotes(template.substring(0, firstIdx)), pluralVariant, idx, result.prefixes);
|
||||
prefix, pluralVariant, idx, result.prefixes);
|
||||
savePrefixOrSuffix(
|
||||
fixQuotes(template.substring(lastIdx + 1)), pluralVariant, idx, result.suffixes);
|
||||
suffix, pluralVariant, idx, result.suffixes);
|
||||
|
||||
// If there is effectively no prefix or suffix, ignore the actual
|
||||
// number of 0's and act as if the number of 0's matches the size
|
||||
// of the number
|
||||
if (prefix.trim().length() == 0 && suffix.trim().length() == 0) {
|
||||
return idx + 1;
|
||||
}
|
||||
|
||||
// Calculate number of zeros before decimal point.
|
||||
int i = firstIdx + 1;
|
||||
|
@ -124,6 +124,12 @@ public class CompactDecimalFormatTest extends TestFmwk {
|
||||
{12712345678901f, "13\u00a0bil."},
|
||||
{127123456789012f, "130\u00a0bil."},
|
||||
};
|
||||
|
||||
Object[][] SkTestDataLong = {
|
||||
{1000, "1000"},
|
||||
{1572, "1600"},
|
||||
{5184, "5200"},
|
||||
};
|
||||
|
||||
public void TestCharacterIterator() {
|
||||
CompactDecimalFormat cdf =
|
||||
@ -150,6 +156,15 @@ public class CompactDecimalFormatTest extends TestFmwk {
|
||||
public void TestCsShort() {
|
||||
checkLocale(ULocale.forLanguageTag("cs"), CompactStyle.SHORT, CsTestDataShort);
|
||||
}
|
||||
|
||||
public void TestSkLong() {
|
||||
// For this Locale, we have
|
||||
// 1000 {
|
||||
// few{"0"}
|
||||
// one{"0"}
|
||||
// other{"0"}
|
||||
checkLocale(ULocale.forLanguageTag("sk"), CompactStyle.LONG, SkTestDataLong);
|
||||
}
|
||||
|
||||
public void TestSerbianShort() {
|
||||
checkLocale(ULocale.forLanguageTag("sr"), CompactStyle.SHORT, SerbianTestDataShort);
|
||||
|
Loading…
Reference in New Issue
Block a user