1
0
mirror of https://github.com/videojs/video.js.git synced 2024-11-24 08:42:25 +02:00

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
This commit is contained in:
André M. 2024-10-30 09:35:04 +01:00 committed by GitHub
parent d2b9d5c974
commit ecef37c1fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View File

@ -87,7 +87,7 @@ class TextTrackFieldset extends Component {
const label = Dom.createEl('label', {
id,
className: 'vjs-label',
textContent: selectConfig.label
textContent: this.localize(selectConfig.label)
});
label.setAttribute('for', guid);

View File

@ -68,7 +68,7 @@ class TextTrackSelect extends Component {
{
id: optionId,
value: this.localize(optionText[0]),
textContent: optionText[1]
textContent: this.localize(optionText[1])
}
);

View File

@ -375,10 +375,16 @@ QUnit.test('should update on languagechange', function(assert) {
tracks
});
videojs.addLanguage('test', {'Font Size': 'FONTSIZE'});
videojs.addLanguage('test', {
'Font Size': 'FONTSIZE',
'Color': 'COLOR',
'White': 'WHITE'
});
player.language('test');
assert.equal(player.$('.vjs-font-percent legend').textContent, 'FONTSIZE', 'settings dialog updates on languagechange');
assert.equal(player.$('.vjs-text-color label').textContent, 'COLOR', 'settings dialog label updates on languagechange');
assert.equal(player.$('.vjs-text-color select option').textContent, 'WHITE', 'settings dialog select updates on languagechange');
player.dispose();
});