Commit b4ba04ba by Alexander Kryklia

Transcript translations should be displayed in their source language.

parent b3f479c8
...@@ -5,6 +5,8 @@ These are notable changes in edx-platform. This is a rolling list of changes, ...@@ -5,6 +5,8 @@ These are notable changes in edx-platform. This is a rolling list of changes,
in roughly chronological order, most recent first. Add your entries at or near in roughly chronological order, most recent first. Add your entries at or near
the top. Include a label indicating the component affected. the top. Include a label indicating the component affected.
Blades: Transcript translations should be displayed in their source language (BLD-935).
Blades: Create an upload modal for video transcript translations (BLD-751). Blades: Create an upload modal for video transcript translations (BLD-751).
Studio: Add ability to reorder Pages and hide the Wiki page. STUD-1375 Studio: Add ability to reorder Pages and hide the Wiki page. STUD-1375
......
...@@ -122,8 +122,9 @@ class VideoModule(VideoFields, VideoStudentViewHandlers, XModule): ...@@ -122,8 +122,9 @@ class VideoModule(VideoFields, VideoStudentViewHandlers, XModule):
else: else:
transcript_language = sorted(self.transcripts.keys())[0] transcript_language = sorted(self.transcripts.keys())[0]
native_languages = {lang: label for lang, label in settings.LANGUAGES if len(lang) == 2}
languages = { languages = {
lang: display lang: native_languages.get(lang, display)
for lang, display in settings.ALL_LANGUAGES for lang, display in settings.ALL_LANGUAGES
if lang in self.transcripts if lang in self.transcripts
} }
...@@ -242,7 +243,9 @@ class VideoDescriptor(VideoFields, VideoStudioViewHandlers, TabsEditingDescripto ...@@ -242,7 +243,9 @@ class VideoDescriptor(VideoFields, VideoStudioViewHandlers, TabsEditingDescripto
else: else:
editable_fields.pop('source') editable_fields.pop('source')
languages = [{'label': label, 'code': lang} for lang, label in settings.ALL_LANGUAGES if lang != u'en'] native_languages = {lang: label for lang, label in settings.LANGUAGES if len(lang) == 2}
languages = [{'label': native_languages.get(lang, label), 'code': lang} for lang, label in settings.ALL_LANGUAGES if lang != u'en']
languages.sort(key=lambda l: l['label']) languages.sort(key=lambda l: l['label'])
editable_fields['transcripts']['languages'] = languages editable_fields['transcripts']['languages'] = languages
editable_fields['transcripts']['type'] = 'VideoTranslations' editable_fields['transcripts']['type'] = 'VideoTranslations'
......
...@@ -53,7 +53,7 @@ class TestVideoYouTube(TestVideo): ...@@ -53,7 +53,7 @@ class TestVideoYouTube(TestVideo):
'transcript_download_format': 'srt', 'transcript_download_format': 'srt',
'transcript_download_formats_list': [{'display_name': 'SubRip (.srt) file', 'value': 'srt'}, {'display_name': 'Text (.txt) file', 'value': 'txt'}], 'transcript_download_formats_list': [{'display_name': 'SubRip (.srt) file', 'value': 'srt'}, {'display_name': 'Text (.txt) file', 'value': 'txt'}],
'transcript_language': u'en', 'transcript_language': u'en',
'transcript_languages': '{"en": "English", "uk": "Ukrainian"}', 'transcript_languages': '{"en": "English", "uk": u"Українська"}',
'transcript_translation_url': self.item_descriptor.xmodule_runtime.handler_url( 'transcript_translation_url': self.item_descriptor.xmodule_runtime.handler_url(
self.item_descriptor, 'transcript', 'translation' self.item_descriptor, 'transcript', 'translation'
).rstrip('/?'), ).rstrip('/?'),
...@@ -532,3 +532,10 @@ class VideoDescriptorTest(unittest.TestCase): ...@@ -532,3 +532,10 @@ class VideoDescriptorTest(unittest.TestCase):
] ]
rendered_context = self.descriptor.get_context() rendered_context = self.descriptor.get_context()
self.assertListEqual(rendered_context['tabs'], correct_tabs) self.assertListEqual(rendered_context['tabs'], correct_tabs)
def test_editable_metadata_fields(self):
output = self.descriptor.editable_metadata_fields
self.assertEqual(
[d['label'] for d in output['transcripts']['languages'] if d['code'] == u'uk'][0],
u'Українська'
)
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