summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordzhuang <dzhuang.scut@gmail.com>2018-03-13 00:50:43 +0800
committerTim Graham <timograham@gmail.com>2018-03-13 11:09:31 -0400
commit59f39ccad8478c091161bf54046cd7b774614e62 (patch)
tree03fe1ee6522615e02545412c6a33cab451b7f941
parent172e5132ba1aec505a55ee3d2ca6486f0351b2cd (diff)
[2.0.x] Fixed #29213 -- Fixed autocomplete widget's translations for zh-hans/zh-hant.
Backport of e17088a108e604cad23b000a83189fdd02a8a2f9 from master
-rw-r--r--django/contrib/admin/widgets.py3
-rw-r--r--docs/releases/2.0.4.txt3
-rw-r--r--tests/admin_widgets/test_autocomplete_widget.py3
3 files changed, 7 insertions, 2 deletions
diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py
index b14536342e..c69aa78d41 100644
--- a/django/contrib/admin/widgets.py
+++ b/django/contrib/admin/widgets.py
@@ -390,8 +390,9 @@ SELECT2_TRANSLATIONS = {x.lower(): x for x in [
'eu', 'fa', 'fi', 'fr', 'gl', 'he', 'hi', 'hr', 'hu', 'id', 'is',
'it', 'ja', 'km', 'ko', 'lt', 'lv', 'mk', 'ms', 'nb', 'nl', 'pl',
'pt-BR', 'pt', 'ro', 'ru', 'sk', 'sr-Cyrl', 'sr', 'sv', 'th',
- 'tr', 'uk', 'vi', 'zh-CN', 'zh-TW',
+ 'tr', 'uk', 'vi',
]}
+SELECT2_TRANSLATIONS.update({'zh-hans': 'zh-CN', 'zh-hant': 'zh-TW'})
class AutocompleteMixin:
diff --git a/docs/releases/2.0.4.txt b/docs/releases/2.0.4.txt
index 222b2360a5..ce7a495a6d 100644
--- a/docs/releases/2.0.4.txt
+++ b/docs/releases/2.0.4.txt
@@ -11,3 +11,6 @@ Bugfixes
* Fixed a crash when filtering with an ``Exists()`` annotation of a queryset
containing a single field (:ticket:`29195`).
+
+* Fixed admin autocomplete widget's translations for `zh-hans` and `zh-hant`
+ languages (:ticket:`29213`).
diff --git a/tests/admin_widgets/test_autocomplete_widget.py b/tests/admin_widgets/test_autocomplete_widget.py
index 28167dfe1c..32c0964d87 100644
--- a/tests/admin_widgets/test_autocomplete_widget.py
+++ b/tests/admin_widgets/test_autocomplete_widget.py
@@ -120,7 +120,8 @@ class AutocompleteMixinTests(TestCase):
('00', None),
# Language files are case sensitive.
('sr-cyrl', 'sr-Cyrl'),
- ('zh-cn', 'zh-CN'),
+ ('zh-hans', 'zh-CN'),
+ ('zh-hant', 'zh-TW'),
)
for lang, select_lang in languages:
with self.subTest(lang=lang):