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:
Edward Welbourne 2020-03-17 12:09:30 +01:00 committed by Edward Welbourne
parent 81cf23c7a7
commit 89bd12b9ad
3 changed files with 439 additions and 439 deletions

File diff suppressed because it is too large Load Diff

View File

@ -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)),

View File

@ -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)))