mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-17 02:37:25 +00:00
ICU-20264 FixedDecimal.toString locale independent
This commit is contained in:
parent
994edfe858
commit
ee71b22847
2 changed files with 12 additions and 1 deletions
|
@ -882,7 +882,7 @@ public class PluralRules implements Serializable {
|
|||
@Deprecated
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%." + visibleDecimalDigitCount + "f", source);
|
||||
return String.format(Locale.ROOT, "%." + visibleDecimalDigitCount + "f", source);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1186,4 +1186,15 @@ public class PluralRulesTest extends TestFmwk {
|
|||
PluralRules rulesJ1 = PluralRules.forLocale(Locale.FRANCE, PluralType.ORDINAL);
|
||||
assertEquals("forLocale() with type", rulesU1, rulesJ1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBug20264() {
|
||||
String expected = "1.23400";
|
||||
FixedDecimal fd = new FixedDecimal(1.234, 5, 2);
|
||||
assertEquals("FixedDecimal toString", expected, fd.toString());
|
||||
Locale.setDefault(Locale.FRENCH);
|
||||
assertEquals("FixedDecimal toString", expected, fd.toString());
|
||||
Locale.setDefault(Locale.GERMAN);
|
||||
assertEquals("FixedDecimal toString", expected, fd.toString());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue