Kaydet (Commit) ac59ec8f authored tarafından Hasan Ramezani's avatar Hasan Ramezani Kaydeden (comit) Tim Graham

Aliased trans_null.to_locale() to trans_real.to_locale().

The implementations have unintentionally diverged.
üst a5a2ceeb
......@@ -4,6 +4,8 @@
from django.conf import settings
from .trans_real import to_locale as trans_real_to_locale
def gettext(message):
return message
......@@ -52,12 +54,7 @@ def check_for_language(x):
return True
def to_locale(language):
p = language.find('-')
if p >= 0:
return language[:p].lower() + '_' + language[p + 1:].upper()
else:
return language.lower()
to_locale = trans_real_to_locale
def get_language_from_request(request, check_path=False):
......
......@@ -286,6 +286,7 @@ class TranslationTests(SimpleTestCase):
for lang, locale in tests:
with self.subTest(lang=lang):
self.assertEqual(to_locale(lang), locale)
self.assertEqual(trans_null.to_locale(lang), locale)
def test_to_language(self):
self.assertEqual(trans_real.to_language('en_US'), 'en-us')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment