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/localexml.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/localexml.py')
-rw-r--r-- | util/local_database/localexml.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/util/local_database/localexml.py b/util/local_database/localexml.py index 6db10e2b9a..a47fa6a5ff 100644 --- a/util/local_database/localexml.py +++ b/util/local_database/localexml.py @@ -111,6 +111,7 @@ class Locale: __astxt = ("language", "languageEndonym", "script", "country", "countryEndonym", "listPatternPartStart", "listPatternPartMiddle", "listPatternPartEnd", "listPatternPartTwo", "am", "pm", + 'byte_unit', 'byte_si_quantified', 'byte_iec_quantified', "currencyIsoCode", "currencySymbol", "currencyDisplayName", "currencyFormat", "currencyNegativeFormat" ) + tuple(propsMonthDay()) @@ -169,6 +170,7 @@ class Locale: 'alternateQuotationStart', 'alternateQuotationEnd', 'listPatternPartStart', 'listPatternPartMiddle', 'listPatternPartEnd', 'listPatternPartTwo', + 'byte_unit', 'byte_si_quantified', 'byte_iec_quantified', 'am', 'pm', 'firstDayOfWeek', 'weekendStart', 'weekendEnd', 'longDateFormat', 'shortDateFormat', @@ -180,7 +182,7 @@ class Locale: 'standaloneLongDays', 'standaloneShortDays', 'standaloneNarrowDays', 'currencyIsoCode', 'currencySymbol', 'currencyDisplayName', 'currencyFormat', 'currencyNegativeFormat'): - ent = camelCase(key.split('_')) if '_' in key else key + ent = camelCase(key.split('_')) if key.endswith('_endonym') else key print inner + "<%s>%s</%s>" % (ent, escape(get(key)).encode('utf-8'), ent) for key in ('currencyDigits', 'currencyRounding'): @@ -198,7 +200,8 @@ class Locale: months = ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', ''), days = ('Sunday', 'Monday', 'Tuesday', 'Wednesday', - 'Thursday', 'Friday', 'Saturday', '')): + 'Thursday', 'Friday', 'Saturday', ''), + quantifiers=('k', 'M', 'G', 'T', 'P', 'E')): """Returns an object representing the C locale.""" return cls(language='C', language_code='0', language_endonym='', script='AnyScript', script_code='0', @@ -211,6 +214,9 @@ class Locale: listPatternPartMiddle='%1, %2', listPatternPartEnd='%1, %2', listPatternPartTwo='%1, %2', + byte_unit='bytes', + byte_si_quantified=';'.join(q + 'B' for q in quantifiers), + byte_iec_quantified=';'.join(q.upper() + 'iB' for q in quantifiers), am='AM', pm='PM', firstDayOfWeek='mon', weekendStart='sat', weekendEnd='sun', longDateFormat='EEEE, d MMMM yyyy', shortDateFormat='d MMM yyyy', |