summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorEdward Welbourne <eddy@chaos.org.uk>2020-03-16 10:53:53 +0100
committerEdward Welbourne <eddy@chaos.org.uk>2020-04-02 19:43:23 +0100
commite5eb0aa4281016e7a2b3fd5c4381999c91438f5b (patch)
tree8e5c1f18e5375ee5330c0d53449ac4b3ed0a31b1 /util
parentbe3dfd7a71a276b10bac50075b26c6af58b9d02b (diff)
Take number system into account in currency format look-up
CLDR's currency formats do have number system variation, so take it into account. (The old xpathlite code clearly intended to do this, but failed at it due to looking for the wrong component of an XPATH to fix.) This changes the currency formats in use for * all Dutch locales (because nl.xml lists a currency format for arab before the one for latn, and they differ), * Punjabi, Urdu - specifically pa_Guru_IN, ur_Arab_PK (both like Dutch, arabext before latn; which is correct for pa_Arab_PK and ur_Arab_IN), * Sindi (whose over-ride of latn currency format we were using, where we should be using arab's format, supplied by root's default), * Tatar (which specifies a generic currency format, which we were using, before one specific to latn, which we now use), * Tongan (same as Dutch), * Konkani (like Dutch, deva before latn) and * several North African Arabic locales (whose default number system is latn, rather than arab, but previously used arab's formats). Task-number: QTBUG-79902 Change-Id: I18d8ec16bfd3a516d1bcd2f63bc7f7f15179a3f4 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'util')
-rw-r--r--util/locale_database/ldml.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/util/locale_database/ldml.py b/util/locale_database/ldml.py
index ff94f3da73..a4a8448a43 100644
--- a/util/locale_database/ldml.py
+++ b/util/locale_database/ldml.py
@@ -323,7 +323,12 @@ class LocaleScanner (object):
yield 'minus', minus
# Currency formatting (currencyFormat may have a type field):
- money = self.find('numbers/currencyFormats/currencyFormatLength/currencyFormat/pattern')
+ xpath = 'numbers/currencyFormats/currencyFormatLength/currencyFormat/pattern'
+ try:
+ money = self.find(xpath.replace('Formats/',
+ 'Formats[numberSystem={}]/'.format(system)))
+ except Error:
+ money = self.find(xpath)
money = self.__currencyFormats(money, plus, minus)
yield 'currencyFormat', money.next()
neg = ''