From e5eb0aa4281016e7a2b3fd5c4381999c91438f5b Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 16 Mar 2020 10:53:53 +0100 Subject: 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 --- util/locale_database/ldml.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'util') 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 = '' -- cgit v1.2.3