Removed to_lower parameter for translation's to_locale().

Unused since 2bab9d6d9e.
This commit is contained in:
Tim Graham 2017-09-07 09:35:32 -04:00
parent ff17ef1ada
commit 22a5b8891c
1 changed files with 6 additions and 12 deletions

View File

@ -56,20 +56,14 @@ def reset_cache(**kwargs):
get_supported_language_variant.cache_clear()
def to_locale(language, to_lower=False):
"""
Turn a language name (en-us) into a locale name (en_US). If 'to_lower' is
True, the last component is lower-cased (en_us).
"""
def to_locale(language):
"""Turn a language name (en-us) into a locale name (en_US)."""
p = language.find('-')
if p >= 0:
if to_lower:
return language[:p].lower() + '_' + language[p + 1:].lower()
else:
# Get correct locale for sr-latn
if len(language[p + 1:]) > 2:
return language[:p].lower() + '_' + language[p + 1].upper() + language[p + 2:].lower()
return language[:p].lower() + '_' + language[p + 1:].upper()
# Get correct locale for sr-latn
if len(language[p + 1:]) > 2:
return language[:p].lower() + '_' + language[p + 1].upper() + language[p + 2:].lower()
return language[:p].lower() + '_' + language[p + 1:].upper()
else:
return language.lower()