Change QLocale to use CLDR's accounting formats for currencies
In particular, this changed the US currency formats for negative amounts to be parenthesised versions of the positive amount forms, rather than having a minus sign after the $ sign. Test updated. [ChangeLog][QtCore][QLocale] Currency formats are now based on CLDR's accounting formats, where they were previously mostly based (more or less by accident) on standard formats. In particular, this now means negative currency formats are specified, where available, where they (mostly) were not previously. Task-number: QTBUG-79902 Change-Id: Ie0c07515ece8bd518a74a6956bf97ca85e9894eb Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
This commit is contained in:
parent
81cf23c7a7
commit
89bd12b9ad
File diff suppressed because it is too large
Load Diff
@ -2569,12 +2569,12 @@ void tst_QLocale::currency()
|
||||
|
||||
const QLocale en_US("en_US");
|
||||
QCOMPARE(en_US.toCurrencyString(qulonglong(1234)), QString("$1,234"));
|
||||
QCOMPARE(en_US.toCurrencyString(qlonglong(-1234)), QString("$-1,234"));
|
||||
QCOMPARE(en_US.toCurrencyString(qlonglong(-1234)), QString("($1,234)"));
|
||||
QCOMPARE(en_US.toCurrencyString(double(1234.56)), QString("$1,234.56"));
|
||||
QCOMPARE(en_US.toCurrencyString(double(-1234.56)), QString("$-1,234.56"));
|
||||
QCOMPARE(en_US.toCurrencyString(double(-1234.5678)), QString("$-1,234.57"));
|
||||
QCOMPARE(en_US.toCurrencyString(double(-1234.5678), NULL, 4), QString("$-1,234.5678"));
|
||||
QCOMPARE(en_US.toCurrencyString(double(-1234.56), NULL, 4), QString("$-1,234.5600"));
|
||||
QCOMPARE(en_US.toCurrencyString(double(-1234.56)), QString("($1,234.56)"));
|
||||
QCOMPARE(en_US.toCurrencyString(double(-1234.5678)), QString("($1,234.57)"));
|
||||
QCOMPARE(en_US.toCurrencyString(double(-1234.5678), NULL, 4), QString("($1,234.5678)"));
|
||||
QCOMPARE(en_US.toCurrencyString(double(-1234.56), NULL, 4), QString("($1,234.5600)"));
|
||||
|
||||
const QLocale ru_RU("ru_RU");
|
||||
QCOMPARE(ru_RU.toCurrencyString(qulonglong(1234)),
|
||||
|
@ -348,7 +348,7 @@ class LocaleScanner (object):
|
||||
yield 'minus', minus
|
||||
|
||||
# Currency formatting:
|
||||
xpath = 'numbers/currencyFormats/currencyFormatLength/currencyFormat[standard]/pattern'
|
||||
xpath = 'numbers/currencyFormats/currencyFormatLength/currencyFormat[accounting]/pattern'
|
||||
try:
|
||||
money = self.find(xpath.replace('Formats/',
|
||||
'Formats[numberSystem={}]/'.format(system)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user