diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2017-05-30 14:55:33 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2017-06-13 11:28:09 +0000 |
commit | 424d9e9e56314bae09a0dcbf09be0e3c0c9e0ac6 (patch) | |
tree | 24f213cbb1f3b6be0a8c865fc901007965a27bcf /util/local_database/qlocalexml2cpp.py | |
parent | 536b918ecaed0b8a04ca2b7c0884eea12ddb6931 (diff) |
Add byte-based units to CLDR data
Scan CLDR for {,kilo,mega,giga,tera,peta,exa}byte forms and their IEC
equivalents, providing SI and IEC defaults when missing (which all of
IEC are) in addition to the usual numeric data. Extrapolate from any
present data (e.g. French's ko, Mo, Go, To imply Po, Eo and, for IEC,
Kio, Mio, etc.), since CLDR only goes up to tera. Propagate this data
to QLocale's database ready for use by QLocale::formattedDataSize().
Change-Id: Ie6ee978948c68be9f71ab784a128cbfae3d80ee1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'util/local_database/qlocalexml2cpp.py')
-rwxr-xr-x | util/local_database/qlocalexml2cpp.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/util/local_database/qlocalexml2cpp.py b/util/local_database/qlocalexml2cpp.py index baa5a60263..0f10f8ce2d 100755 --- a/util/local_database/qlocalexml2cpp.py +++ b/util/local_database/qlocalexml2cpp.py @@ -445,6 +445,7 @@ def main(): days_data = StringData('days_data') am_data = StringData('am_data') pm_data = StringData('pm_data') + byte_unit_data = StringData('byte_unit_data') currency_symbol_data = StringData('currency_symbol_data') currency_display_name_data = StringData('currency_display_name_data') currency_format_data = StringData('currency_format_data') @@ -494,6 +495,10 @@ def main(): + ' nDays ' + ' am ' # am/pm indicators + ' pm ' + # Width 8 + comma + + ' byte ' + + ' siQuant ' + + 'iecQuant ' # Width 8+4 + comma + ' currISO ' # Width 11 + comma: @@ -527,6 +532,8 @@ def main(): + '%8d,' * 4 # List patterns, date/time formats, month/day names, am/pm: + '%11s,' * 22 + # SI/IEC byte-unit abbreviations: + + '%8s,' * 3 # Currency ISO code: + ' %10s, ' # Currency and endonyms @@ -574,6 +581,9 @@ def main(): days_data.append(l.narrowDays), am_data.append(l.am), pm_data.append(l.pm), + byte_unit_data.append(l.byte_unit), + byte_unit_data.append(l.byte_si_quantified), + byte_unit_data.append(l.byte_iec_quantified), currencyIsoCodeData(l.currencyIsoCode), currency_symbol_data.append(l.currencySymbol), currency_display_name_data.append(l.currencyDisplayName), @@ -588,7 +598,7 @@ def main(): l.weekendEnd) + ", // %s/%s/%s\n" % (l.language, l.script, l.country)) data_temp_file.write(line_format # All zeros, matching the format: - % ( (0,) * (3 + 8 + 4) + ("0,0",) * 22 + % ( (0,) * (3 + 8 + 4) + ("0,0",) * (22 + 3) + (currencyIsoCodeData(0),) + ("0,0",) * 6 + (0,) * (2 + 3)) + " // trailing 0s\n") @@ -597,7 +607,7 @@ def main(): # StringData tables: for data in (list_pattern_part_data, date_format_data, time_format_data, months_data, days_data, - am_data, pm_data, currency_symbol_data, + byte_unit_data, am_data, pm_data, currency_symbol_data, currency_display_name_data, currency_format_data, endonyms_data): data_temp_file.write("\nstatic const ushort %s[] = {\n" % data.name) |