remove unused locale table data

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2019-08-09 15:29:13 +00:00
parent 92b514fc06
commit ce5faab20c
4 changed files with 1069 additions and 1628 deletions

View file

@ -41,11 +41,6 @@ def tochar(fromstring):
return '"%s\\0"' % fromstring return '"%s\\0"' % fromstring
return 'Q_NULLPTR' return 'Q_NULLPTR'
def toescapedchar(fromstring):
if fromstring:
return '"%s\\0"' % fromstring.replace('"', '\\"')
return 'Q_NULLPTR'
def tochararray(fromstringlist): def tochararray(fromstringlist):
result = '{ ' result = '{ '
for string in fromstringlist: for string in fromstringlist:
@ -308,7 +303,7 @@ def printlocaledata(frommap, key):
// week // week
%s, %s, %s, %s, %s, %s,
// symbols // symbols
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
// quotation // quotation
%s, %s, %s, %s, %s, %s, %s, %s,
// endonym // endonym
@ -320,8 +315,7 @@ def printlocaledata(frommap, key):
// am/pm // am/pm
%s, %s, %s, %s,
// currency // currency
%s, %s, %s, %s, %s, %s, %s, %s, %s,
%s,
// month names // month names
%s, %s,
%s, %s,
@ -351,7 +345,6 @@ def printlocaledata(frommap, key):
touint(value['plus']), touint(value['plus']),
touint(value['exponential']), touint(value['exponential']),
value['currency_digits'], value['currency_digits'],
value['currency_rounding'],
touint(value['zero']), touint(value['zero']),
touint(value['quotation_start']), touint(value['quotation_start']),
touint(value['quotation_end']), touint(value['quotation_end']),
@ -373,7 +366,7 @@ def printlocaledata(frommap, key):
tochar(value['currency_format']), tochar(value['currency_format']),
tochar(value['currency_negative_format']), tochar(value['currency_negative_format']),
tochar(value['currency_iso_code']), tochar(value['currency_iso_code']),
tochararray(value['currency_display_name']), tochar(value['currency_display_name']),
tochararray(value['standalone_short_month_names']), tochararray(value['standalone_short_month_names']),
tochararray(value['standalone_long_month_names']), tochararray(value['standalone_long_month_names']),
tochararray(value['standalone_narrow_month_names']), tochararray(value['standalone_narrow_month_names']),
@ -490,11 +483,7 @@ for region in root.findall('./currencyData/region'):
for info in root.findall('./currencyData/fractions/info'): for info in root.findall('./currencyData/fractions/info'):
infoiso4217 = info.get('iso4217') infoiso4217 = info.get('iso4217')
infodigits = info.get('digits') infodigits = info.get('digits')
inforounding = info.get('rounding') localecurrencymap[infoiso4217] = infodigits
localecurrencymap[infoiso4217] = {
'digits': infodigits,
'rounding': inforounding,
}
# locale to numbering system parsing # locale to numbering system parsing
tree = ET.parse('common/supplemental/numberingSystems.xml') tree = ET.parse('common/supplemental/numberingSystems.xml')
@ -580,7 +569,6 @@ localedefaults = {
'plus': '+', 'plus': '+',
'exponential': 'e', # default in CLDR is E 'exponential': 'e', # default in CLDR is E
'currency_digits': '2', 'currency_digits': '2',
'currency_rounding': '1', # not used, default in CLDR is 0
# strings # strings
'quotation_start': '"', # default in CLDR is “ 'quotation_start': '"', # default in CLDR is “
'quotation_end': '"', # default in CLDR is ” 'quotation_end': '"', # default in CLDR is ”
@ -602,8 +590,8 @@ localedefaults = {
'currency_format': '%1%2', 'currency_format': '%1%2',
'currency_negative_format': '', 'currency_negative_format': '',
'currency_iso_code': '', 'currency_iso_code': '',
'currency_display_name': '',
# arrays # arrays
'currency_display_name': ['', '', '', '', '', '', ''], # only the first entry is used
'standalone_short_month_names': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], 'standalone_short_month_names': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
'standalone_long_month_names': ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], 'standalone_long_month_names': ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
'standalone_narrow_month_names': ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'], 'standalone_narrow_month_names': ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
@ -764,9 +752,7 @@ def readlocale(fromxml, tomap, isparent):
# digits/rounding data is specific so check if it is mapped # digits/rounding data is specific so check if it is mapped
if currencytype and currencytype in localecurrencymap.keys(): if currencytype and currencytype in localecurrencymap.keys():
tomap[locale]['currency_digits'] = localecurrencymap[currencytype]['digits'] tomap[locale]['currency_digits'] = localecurrencymap[currencytype]
tomap[locale]['currency_rounding'] = localecurrencymap[currencytype]['rounding']
quotationstart = root.find('./delimiters/quotationStart') quotationstart = root.find('./delimiters/quotationStart')
if quotationstart is not None: if quotationstart is not None:
@ -912,27 +898,13 @@ def readlocale(fromxml, tomap, isparent):
if symbol is not None: if symbol is not None:
tomap[locale]['currency_symbol'] = symbol.text tomap[locale]['currency_symbol'] = symbol.text
displaynamelist = []
listcopy(tomap[locale]['currency_display_name'], displaynamelist)
for displayname in elemcurrency.findall('./displayName'): for displayname in elemcurrency.findall('./displayName'):
displaynamecount = displayname.get('count') displaynamecount = displayname.get('count')
# TODO: 0 and 1 are aliases?
if not displaynamecount: if not displaynamecount:
displaynamelist[0] = displayname.text # only interested in default display name
elif displaynamecount == 'zero': tomap[locale]['currency_display_name'] = displayname.text
displaynamelist[1] = displayname.text break
elif displaynamecount == 'one':
displaynamelist[2] = displayname.text
elif displaynamecount == 'two':
displaynamelist[3] = displayname.text
elif displaynamecount == 'few':
displaynamelist[4] = displayname.text
elif displaynamecount == 'many':
displaynamelist[5] = displayname.text
elif displaynamecount == 'other':
displaynamelist[6] = displayname.text
tomap[locale]['currency_display_name'] = displaynamelist
# currency type was found, break # currency type was found, break
break break

View file

@ -2881,12 +2881,11 @@ QString QLocale::currencySymbol(QLocale::CurrencySymbolFormat format) const
return res.toString(); return res.toString();
} }
#endif #endif
quint16 idx = 0;
switch (format) { switch (format) {
case CurrencySymbol: case CurrencySymbol:
return getLocaleData(d()->m_currency_symbol); return getLocaleData(d()->m_currency_symbol);
case CurrencyDisplayName: case CurrencyDisplayName:
return getLocaleListData(d()->m_currency_display_name, idx); return getLocaleData(d()->m_currency_display_name);
case CurrencyIsoCode: { case CurrencyIsoCode: {
return QString::fromLatin1(d()->m_currency_iso_code); return QString::fromLatin1(d()->m_currency_iso_code);
} }

File diff suppressed because it is too large Load diff

View file

@ -173,7 +173,6 @@ public:
ushort m_plus; ushort m_plus;
ushort m_exponential; ushort m_exponential;
ushort m_currency_digits; ushort m_currency_digits;
ushort m_currency_rounding;
uint m_zero; uint m_zero;
uint m_quotation_start; uint m_quotation_start;
uint m_quotation_end; uint m_quotation_end;
@ -195,7 +194,7 @@ public:
const char* m_currency_format; const char* m_currency_format;
const char* m_currency_negative_format; const char* m_currency_negative_format;
const char* m_currency_iso_code; const char* m_currency_iso_code;
const char* m_currency_display_name[7]; const char* m_currency_display_name;
const char* m_standalone_short_month_names[12]; const char* m_standalone_short_month_names[12];
const char* m_standalone_long_month_names[12]; const char* m_standalone_long_month_names[12];
const char* m_standalone_narrow_month_names[12]; const char* m_standalone_narrow_month_names[12];