-
-
Save DenverCoder1/9c34fb012cefdc75f8d53724c24fe260 to your computer and use it in GitHub Desktop.
python-babel/babel#932 locale searches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from babel.core import Locale | |
| from babel.localedata import locale_identifiers | |
| def find_plural_forms_with_one_where_not_appearing_in_formats(): | |
| for identifier in sorted(locale_identifiers()): | |
| locale = Locale.parse(identifier) | |
| short_format = locale.compact_decimal_formats.get('short', {}) | |
| long_format = locale.compact_decimal_formats.get('long', {}) | |
| if ("one" not in short_format or "one" not in long_format) and locale.plural_form(21) == "one": | |
| print(f"{identifier}: {list(short_format.keys())} {list(long_format.keys())}") | |
| def find_explicit_0_formats(): | |
| for identifier in sorted(locale_identifiers()): | |
| locale = Locale.parse(identifier) | |
| short_format = locale.compact_decimal_formats.get('short', {}) | |
| long_format = locale.compact_decimal_formats.get('long', {}) | |
| if "0" in short_format or "0" in long_format: | |
| print(f"{identifier}: {list(short_format.keys())} {list(long_format.keys())}") | |
| find_plural_forms_with_one_where_not_appearing_in_formats() | |
| # ceb: ['other'] [] | |
| # ceb_PH: ['other'] [] | |
| # gv: ['other'] [] | |
| # gv_IM: ['other'] [] | |
| # tzm: ['other'] [] | |
| # tzm_MA: ['other'] [] | |
| find_explicit_0_formats() # no results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment