Commit 57e9566c by bmedx

Change references to zh-cn to zh-hans for Django 1.11 upgrade

parent 979c7cd1
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3,7 +3,7 @@
# This will copy each source language to a new directory at the end of the i18n generate step
# which allows us to migrate to a new locale code without re-creating the Transifex project.
edx_lang_map:
zh_CN: zh_HANS
zh_CN: zh_Hans
locales:
- en # English - Source Language
......
......@@ -35,7 +35,7 @@ class TestInstructorAPIEnrollmentEmailLocalization(SharedModuleStoreTestCase):
# student's language is French, so the emails should all be sent in
# French.
self.instructor = InstructorFactory(course_key=self.course.id)
set_user_preference(self.instructor, LANGUAGE_KEY, 'zh-cn')
set_user_preference(self.instructor, LANGUAGE_KEY, 'zh-hans')
self.client.login(username=self.instructor.username, password='test')
self.student = UserFactory.create()
......
......@@ -835,7 +835,7 @@ class TestRenderMessageToString(SharedModuleStoreTestCase):
self.assertEqual(settings.LANGUAGE_CODE, language_after_rendering)
def test_platform_language_is_used_for_logged_in_user(self):
with override_language('zh_CN'): # simulate a user login
with override_language('zh_Hans'): # simulate a user login
subject, message = self.get_subject_and_message(None)
self.assertIn("You have been", subject)
self.assertIn("You have been", message)
......
......@@ -1045,9 +1045,8 @@ LANGUAGES = [
('ur', u'اردو'), # Urdu
('vi', u'Tiếng Việt'), # Vietnamese
('uz', u'Ўзбек'), # Uzbek
('zh-cn', u'中文 (简体)'), # Chinese (China)
('zh-hk', u'中文 (香港)'), # Chinese (Hong Kong)
('zh-tw', u'中文 (台灣)'), # Chinese (Taiwan)
('zh-hans', u'中文 (简体)'), # Chinese (China)
('zh-hant', u'中文 (台灣)'), # Chinese (Taiwan)
]
LANGUAGE_DICT = dict(LANGUAGES)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -18,16 +18,15 @@ from openedx.core.djangoapps.user_api.preferences.api import get_user_preference
# If django 1.7 or higher is used, the right-side can be updated with new-style codes.
CHINESE_LANGUAGE_CODE_MAP = {
# The following are the new-style language codes for chinese language
'zh-hans': 'zh-CN', # Chinese (Simplified),
'zh-hans-cn': 'zh-CN', # Chinese (Simplified, China)
'zh-hans-sg': 'zh-CN', # Chinese (Simplified, Singapore)
'zh-hans-cn': 'zh-Hans', # Chinese (Simplified, China)
'zh-hans-sg': 'zh-Hans', # Chinese (Simplified, Singapore)
'zh-hant': 'zh-TW', # Chinese (Traditional)
'zh-hant-hk': 'zh-HK', # Chinese (Traditional, Hongkong)
'zh-hant-mo': 'zh-TW', # Chinese (Traditional, Macau)
'zh-hant-tw': 'zh-TW', # Chinese (Traditional, Taiwan)
# The following are the old-style language codes that django does not recognize
'zh-mo': 'zh-TW', # Chinese (Traditional, Macau)
'zh-sg': 'zh-CN', # Chinese (Simplified, Singapore)
'zh-sg': 'zh-Hans', # Chinese (Simplified, Singapore)
}
......
......@@ -110,7 +110,7 @@ class DarkLangMiddlewareTests(TestCase):
def test_accept_multiple_released_langs(self):
DarkLangConfig(
released_languages=('rel, unrel'),
released_languages='rel, unrel',
changed_by=self.user,
enabled=True
).save()
......@@ -166,7 +166,7 @@ class DarkLangMiddlewareTests(TestCase):
def test_partial_match_es419(self, accept_header, expected):
# Release es-419
DarkLangConfig(
released_languages=('es-419, en'),
released_languages='es-419, en',
changed_by=self.user,
enabled=True
).save()
......@@ -179,7 +179,7 @@ class DarkLangMiddlewareTests(TestCase):
def test_partial_match_esar_es(self):
# If I release 'es', 'es-AR' should get 'es', not English
DarkLangConfig(
released_languages=('es, en'),
released_languages='es, en',
changed_by=self.user,
enabled=True
).save()
......@@ -199,7 +199,7 @@ class DarkLangMiddlewareTests(TestCase):
def test_exact_match_gets_priority(self, accept_header, expected):
# Release 'es-419, es, es-es'
DarkLangConfig(
released_languages=('es-419, es, es-es'),
released_languages='es-419, es, es-es',
changed_by=self.user,
enabled=True
).save()
......@@ -220,7 +220,7 @@ class DarkLangMiddlewareTests(TestCase):
# If I release 'es, es-419'
# Latin American codes should get es-419
DarkLangConfig(
released_languages=('es, es-419'),
released_languages='es, es-419',
changed_by=self.user,
enabled=True
).save()
......@@ -243,7 +243,10 @@ class DarkLangMiddlewareTests(TestCase):
"""
Sends a post request to set the preview language
"""
return self.client.post('/update_lang/', {'preview_language': preview_language, 'action': 'set_preview_language'})
return self.client.post(
'/update_lang/',
{'preview_language': preview_language, 'action': 'set_preview_language'}
)
def _post_clear_preview_lang(self):
"""
......@@ -351,12 +354,12 @@ class DarkLangMiddlewareTests(TestCase):
def test_accept_chinese_language_codes(self):
DarkLangConfig(
released_languages=('zh-cn, zh-hk, zh-tw'),
released_languages='zh-hans, zh-hk, zh-tw',
changed_by=self.user,
enabled=True
).save()
self.assertAcceptEquals(
'zh-cn;q=1.0, zh-tw;q=0.5, zh-hk;q=0.3',
'zh-hans;q=1.0, zh-tw;q=0.5, zh-hk;q=0.3',
self.process_middleware_request(accept='zh-Hans;q=1.0, zh-Hant-TW;q=0.5, zh-HK;q=0.3')
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment