Skip to content

Commit ecef37c

Browse files
authored
fix(text-track-settings): localization not correctly applied (#8904)
Localization is not applied correctly in fieldset labels and select options. As a result, the text track setting modal dialog is only half translated. - add `localize` at `label` level in `TextTrackFieldset` - add `localize` at `option` level in `TextTrackSelect` - add test cases
1 parent d2b9d5c commit ecef37c

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/js/tracks/text-track-fieldset.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class TextTrackFieldset extends Component {
8787
const label = Dom.createEl('label', {
8888
id,
8989
className: 'vjs-label',
90-
textContent: selectConfig.label
90+
textContent: this.localize(selectConfig.label)
9191
});
9292

9393
label.setAttribute('for', guid);

src/js/tracks/text-track-select.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class TextTrackSelect extends Component {
6868
{
6969
id: optionId,
7070
value: this.localize(optionText[0]),
71-
textContent: optionText[1]
71+
textContent: this.localize(optionText[1])
7272
}
7373
);
7474

test/unit/tracks/text-track-settings.test.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,16 @@ QUnit.test('should update on languagechange', function(assert) {
375375
tracks
376376
});
377377

378-
videojs.addLanguage('test', {'Font Size': 'FONTSIZE'});
378+
videojs.addLanguage('test', {
379+
'Font Size': 'FONTSIZE',
380+
'Color': 'COLOR',
381+
'White': 'WHITE'
382+
});
379383
player.language('test');
380384

381385
assert.equal(player.$('.vjs-font-percent legend').textContent, 'FONTSIZE', 'settings dialog updates on languagechange');
386+
assert.equal(player.$('.vjs-text-color label').textContent, 'COLOR', 'settings dialog label updates on languagechange');
387+
assert.equal(player.$('.vjs-text-color select option').textContent, 'WHITE', 'settings dialog select updates on languagechange');
382388

383389
player.dispose();
384390
});

0 commit comments

Comments
 (0)