From 22a5b8891c557a90e100ea58ce2e96d40069be11 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 7 Sep 2017 09:35:32 -0400 Subject: [PATCH] Removed to_lower parameter for translation's to_locale(). Unused since 2bab9d6d9ea095c4bcaeede2df576708afd46291. --- django/utils/translation/trans_real.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index 6b3aeb127e..a9447d7896 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -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()