diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js index 7442fdd8ff..f3293cf0e4 100644 --- a/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js +++ b/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js @@ -37,6 +37,19 @@ state = jasmine.initializePlayer(); expect($('.video')).toContainElement('.subtitles'); }); + + it('has appropriate lang attributes', function() { + state = jasmine.initializePlayer(); + + $('.video .toggle-captions').trigger('click'); + + expect($('.video .subtitles-menu')).toHaveAttrs({ + 'lang': 'en' + }); + expect($('.video .closed-captions')).toHaveAttrs({ + 'lang': 'en' + }); + }); it('add transcript control to video player', function () { state = jasmine.initializePlayer(); @@ -247,6 +260,12 @@ expect(state.storage.setItem) .toHaveBeenCalledWith('language', 'de'); expect($('.langs-list li.is-active').length).toBe(1); + expect($('.subtitles .subtitles-menu')).toHaveAttrs({ + 'lang': 'de' + }); + expect($('.closed-captions')).toHaveAttrs({ + 'lang': 'de' + }); }); it('when clicking on link with current language', function () { diff --git a/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js b/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js index fc843c7d6c..b99a1b1128 100644 --- a/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js +++ b/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js @@ -113,7 +113,7 @@ var template = [ '
', '

', - '
    ', + '
      ', '
      ' ].join(''); @@ -687,6 +687,12 @@ state.el.trigger('language_menu:change', [langCode]); self.fetchCaption(); + + // update the closed-captions lang attribute + self.captionDisplayEl.attr('lang', langCode); + + // update the transcript lang attribute + self.subtitlesMenuEl.attr('lang', langCode); } }); }, @@ -759,10 +765,12 @@ .text(gettext('Video transcript')); self.subtitlesEl.find('.transcript-start') - .text(gettext('Start of transcript. Skip to the end.')); + .text(gettext('Start of transcript. Skip to the end.')) + .attr('lang', $('html').attr('lang')); self.subtitlesEl.find('.transcript-end') - .text(gettext('End of transcript. Skip to the start.')); + .text(gettext('End of transcript. Skip to the start.')) + .attr('lang', $('html').attr('lang')); self.container.find('.menu-container .instructions') .text(gettext('Press the UP arrow key to enter the language menu then use UP and DOWN arrow keys to navigate language options. Press ENTER to change to the selected language.')); // jshint ignore:line @@ -1116,7 +1124,8 @@ this.captionDisplayEl .show() - .addClass('is-visible'); + .addClass('is-visible') + .attr('lang', this.state.lang); this.captionControlEl .addClass('is-active')