diff options
| author | Jannis Leidel <jannis@leidel.info> | 2010-01-01 21:38:34 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2010-01-01 21:38:34 +0000 |
| commit | 855e805b4cd1ce40751ef166d36cc6f0ae2a2519 (patch) | |
| tree | b0cf2cab5c175e4fbca84fd1517c1bd0284f8473 /tests | |
| parent | 18c31f608f8dec24386941c37c8bfb7cc731d227 (diff) | |
Fixed #12230 - Updated utils.translation.to_locale to support the special sr_Latn locale. Thanks to Janos Guljas.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12056 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/i18n/tests.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/regressiontests/i18n/tests.py b/tests/regressiontests/i18n/tests.py index e70f3052f1..87351eb6b2 100644 --- a/tests/regressiontests/i18n/tests.py +++ b/tests/regressiontests/i18n/tests.py @@ -7,7 +7,7 @@ from django.conf import settings from django.utils.formats import get_format, date_format, time_format, number_format, localize, localize_input from django.utils.numberformat import format from django.test import TestCase, client -from django.utils.translation import ugettext, ugettext_lazy, activate, deactivate, gettext_lazy +from django.utils.translation import ugettext, ugettext_lazy, activate, deactivate, gettext_lazy, to_locale from forms import I18nForm, SelectDateForm, SelectDateWidget, CompanyForm @@ -81,6 +81,23 @@ class TranslationTests(TestCase): finally: deactivate() + def test_to_locale(self): + """ + Tests the to_locale function and the special case of Serbian Latin + (refs #12230 and r11299) + """ + self.assertEqual(to_locale('en-us'), 'en_US') + self.assertEqual(to_locale('sr-lat'), 'sr_Lat') + + def test_to_language(self): + """ + Test the to_language function + """ + from django.utils.translation.trans_real import to_language + self.assertEqual(to_language('en_US'), 'en-us') + self.assertEqual(to_language('sr_Lat'), 'sr-lat') + + class FormattingTests(TestCase): def setUp(self): |
