mirror of
https://github.com/django/django.git
synced 2025-08-02 18:13:02 +00:00
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.
This commit is contained in:
parent
cb2c3ce154
commit
c0a2388a1c
17 changed files with 2593 additions and 2 deletions
|
@ -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.",
|
||||
])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue