Fixed #29213 -- Fixed autocomplete widget's translations for zh-hans/zh-hant.

This commit is contained in:
dzhuang 2018-03-13 00:50:43 +08:00 committed by Tim Graham
parent 4ab027b944
commit e17088a108
3 changed files with 7 additions and 2 deletions

View File

@ -371,8 +371,9 @@ SELECT2_TRANSLATIONS = {x.lower(): x for x in [
'eu', 'fa', 'fi', 'fr', 'gl', 'he', 'hi', 'hr', 'hu', 'id', 'is', 'eu', 'fa', 'fi', 'fr', 'gl', 'he', 'hi', 'hr', 'hu', 'id', 'is',
'it', 'ja', 'km', 'ko', 'lt', 'lv', 'mk', 'ms', 'nb', 'nl', 'pl', 'it', 'ja', 'km', 'ko', 'lt', 'lv', 'mk', 'ms', 'nb', 'nl', 'pl',
'pt-BR', 'pt', 'ro', 'ru', 'sk', 'sr-Cyrl', 'sr', 'sv', 'th', '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: class AutocompleteMixin:

View File

@ -11,3 +11,6 @@ Bugfixes
* Fixed a crash when filtering with an ``Exists()`` annotation of a queryset * Fixed a crash when filtering with an ``Exists()`` annotation of a queryset
containing a single field (:ticket:`29195`). containing a single field (:ticket:`29195`).
* Fixed admin autocomplete widget's translations for `zh-hans` and `zh-hant`
languages (:ticket:`29213`).

View File

@ -120,7 +120,8 @@ class AutocompleteMixinTests(TestCase):
('00', None), ('00', None),
# Language files are case sensitive. # Language files are case sensitive.
('sr-cyrl', 'sr-Cyrl'), ('sr-cyrl', 'sr-Cyrl'),
('zh-cn', 'zh-CN'), ('zh-hans', 'zh-CN'),
('zh-hant', 'zh-TW'),
) )
for lang, select_lang in languages: for lang, select_lang in languages:
with self.subTest(lang=lang): with self.subTest(lang=lang):