diff options
author | Bouke Haarsma <bouke@webatoom.nl> | 2013-11-04 18:31:34 +0100 |
---|---|---|
committer | Bouke Haarsma <bouke@webatoom.nl> | 2013-11-04 23:03:28 +0100 |
commit | c0a2388a1c4ead1afaec98e4ebc953a772ca3849 (patch) | |
tree | 8cc17cbee0032c9597e69cd53837d9573099541e /tests/deprecation | |
parent | cb2c3ce15443a0666646e8b60984830c38d3ecde (diff) | |
download | django-c0a2388a1c4ead1afaec98e4ebc953a772ca3849.tar.gz |
Fixed #18149 -- Changed language codes for Chinese
Language codes for Chinese are zh_Hans (Simplified) and zh_Hant (Traditional).
Added support for browsers that still send the deprecated language codes.
Thanks to Olli Wang for the report.
Diffstat (limited to 'tests/deprecation')
-rw-r--r-- | tests/deprecation/tests.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/deprecation/tests.py b/tests/deprecation/tests.py index f949bea24e..7d9ed16636 100644 --- a/tests/deprecation/tests.py +++ b/tests/deprecation/tests.py @@ -1,8 +1,8 @@ from __future__ import unicode_literals import warnings -from django.test import SimpleTestCase, RequestFactory -from django.utils import six +from django.test import SimpleTestCase, RequestFactory, override_settings +from django.utils import six, translation from django.utils.deprecation import RenameMethodsBase @@ -186,3 +186,22 @@ class DeprecatingRequestMergeDictTest(SimpleTestCase): '`request.POST` instead.', '`MergeDict` is deprecated, use `dict.update()` instead.', ]) + + +@override_settings(USE_I18N=True) +class DeprecatedChineseLanguageCodes(SimpleTestCase): + def test_deprecation_warning(self): + warnings.simplefilter('always') + + with warnings.catch_warnings(record=True) as recorded: + with translation.override('zh-cn'): + pass + with translation.override('zh-tw'): + pass + msgs = [str(warning.message) for warning in recorded] + self.assertEqual(msgs, [ + "The use of the language code 'zh-cn' is deprecated. " + "Please use the 'zh-hans' translation instead.", + "The use of the language code 'zh-tw' is deprecated. " + "Please use the 'zh-hant' translation instead.", + ]) |