Commit 7babb3ef by Muhammad Ammar

Merge pull request #7696 from…

Merge pull request #7696 from edx/ammar/tnl1740-add-simplified-and-traditional-chinese-transcript-language-options

Add Simplified and Traditional Chinese as Transcript language options
parents 9dfb68c2 cec4bb31
......@@ -509,3 +509,46 @@ class VideoEditorTest(CMSVideoBaseTest):
self.assertTrue(self.video.is_captions_visible())
unicode_text = "莎拉·佩林 (Sarah Palin)".decode('utf-8')
self.assertIn(unicode_text, self.video.captions_lines())
def test_simplified_and_traditional_chinese_transcripts_uploading(self):
"""
Scenario: Translations uploading works correctly
Given I have created a Video component
And I edit the component
And I open tab "Advanced"
And I upload transcript file "simplified_chinese.srt" for "zh_HANS" language code
And I save changes
Then when I view the video it does show the captions
And I see "在线学习是革" text in the captions
And I edit the component
And I open tab "Advanced"
And I upload transcript file "traditional_chinese.srt" for "zh_HANT" language code
And I save changes
Then when I view the video it does show the captions
And I see "在線學習是革" text in the captions
And video subtitle menu has 'zh_HANS', 'zh_HANT' translations for 'Simplified Chinese'
and 'Traditional Chinese' respectively
"""
self._create_video_component()
langs_info = [
('zh_HANS', 'simplified_chinese.srt', '在线学习是革'),
('zh_HANT', 'traditional_chinese.srt', '在線學習是革')
]
for lang_code, lang_file, lang_text in langs_info:
self.edit_component()
self.open_advanced_tab()
self.video.upload_translation(lang_file, lang_code)
self.save_unit_settings()
self.assertTrue(self.video.is_captions_visible())
# If there is only one language then there will be no subtitle/captions menu
if lang_code == 'zh_HANT':
self.video.select_language(lang_code)
unicode_text = lang_text.decode('utf-8')
self.assertIn(unicode_text, self.video.captions_text)
self.assertEqual(self.video.caption_languages, {'zh_HANS': 'Simplified Chinese', 'zh_HANT': 'Traditional Chinese'})
......@@ -679,6 +679,36 @@ class YouTubeVideoTest(VideoBaseTest):
self.assertGreaterEqual(self.video.seconds, 10)
def test_simplified_and_traditional_chinese_transcripts(self):
"""
Scenario: Simplified and Traditional Chinese transcripts work as expected in Youtube mode
Given the course has a Video component in "Youtube" mode
And I have defined a Simplified Chinese transcript for the video
And I have defined a Traditional Chinese transcript for the video
Then I see the correct subtitle language options in cc menu
Then I see the correct text in the captions for Simplified and Traditional Chinese transcripts
And I can download the transcripts for Simplified and Traditional Chinese
And video subtitle menu has 'zh_HANS', 'zh_HANT' translations for 'Simplified Chinese'
and 'Traditional Chinese' respectively
"""
data = {
'download_track': True,
'transcripts': {'zh_HANS': 'simplified_chinese.srt', 'zh_HANT': 'traditional_chinese.srt'}
}
self.metadata = self.metadata_for_mode('youtube', data)
self.assets.extend(['simplified_chinese.srt', 'traditional_chinese.srt'])
self.navigate_to_video()
langs = {'zh_HANS': '在线学习是革', 'zh_HANT': '在線學習是革'}
for lang_code, text in langs.items():
self.assertTrue(self.video.select_language(lang_code))
unicode_text = text.decode('utf-8')
self.assertIn(unicode_text, self.video.captions_text)
self.assertTrue(self.video.downloaded_transcript_contains_text('srt', unicode_text))
self.assertEqual(self.video.caption_languages, {'zh_HANS': 'Simplified Chinese', 'zh_HANT': 'Traditional Chinese'})
class YouTubeHtml5VideoTest(VideoBaseTest):
""" Test YouTube HTML5 Video Player """
......
0
00:00:00,260 --> 00:00:01,510
ANANT AGARWAL:欢迎EDX
1
00:00:01,510 --> 00:00:04,480
我阿南特阿加瓦尔,我EDX的总裁,
2
00:00:04,480 --> 00:00:07,430
我也是电气工程和计算机科学教授
3
00:00:07,430 --> 00:00:08,400
在麻省理工学院
4
00:00:08,400 --> 00:00:11,120
在线学习是革命性的世界
5
00:00:11,120 --> 00:00:14,290
教育永远不会再是相同的,和EDX
6
00:00:14,290 --> 00:00:16,650
在这个革命的前沿
\ No newline at end of file
0
00:00:00,260 --> 00:00:01,510
ANANT AGARWAL:歡迎EDX
1
00:00:01,510 --> 00:00:04,480
我阿南特阿加瓦爾,我EDX總裁
2
00:00:04,480 --> 00:00:07,430
我也是電氣工程和計算機科學教授
3
00:00:07,430 --> 00:00:08,400
在麻省理工學院
4
00:00:08,400 --> 00:00:11,120
在線學習是革命性的世界
5
00:00:11,120 --> 00:00:14,290
教育永遠不會再是相同的,和EDX
6
00:00:14,290 --> 00:00:16,650
在這個革命的前沿
\ No newline at end of file
......@@ -1957,6 +1957,8 @@ ALL_LANGUAGES = (
[u"ch", u"Chamorro"],
[u"ce", u"Chechen"],
[u"zh", u"Chinese"],
[u"zh_HANS", u"Simplified Chinese"],
[u"zh_HANT", u"Traditional Chinese"],
[u"cu", u"Church Slavic"],
[u"cv", u"Chuvash"],
[u"kw", u"Cornish"],
......
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