mirror of https://github.com/django/django.git
Removed to_lower parameter for translation's to_locale().
Unused since 2bab9d6d9e
.
This commit is contained in:
parent
ff17ef1ada
commit
22a5b8891c
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue