Fix remaining untranslated ctrls
Ticket: 1507
This commit is contained in:
parent
97be848554
commit
be7193382c
2 changed files with 35 additions and 14 deletions
|
@ -1676,6 +1676,7 @@
|
||||||
"Default Mode (t)": "Default Mode (t)",
|
"Default Mode (t)": "Default Mode (t)",
|
||||||
"Chapters": "Chapters",
|
"Chapters": "Chapters",
|
||||||
"Quality": "Quality",
|
"Quality": "Quality",
|
||||||
|
"Open Chromecast menu": "Open Chromecast menu",
|
||||||
"Auto": "Auto",
|
"Auto": "Auto",
|
||||||
"Auto --[Video quality. Short form]--": "Auto",
|
"Auto --[Video quality. Short form]--": "Auto",
|
||||||
"Auto %quality% --[Video quality popup. Long form.]--": "Auto %quality%",
|
"Auto %quality% --[Video quality popup. Long form.]--": "Auto %quality%",
|
||||||
|
|
|
@ -24,15 +24,19 @@ import type { Player } from '../../videojs';
|
||||||
const VERSION = '1.0.0';
|
const VERSION = '1.0.0';
|
||||||
const defaultOptions = {};
|
const defaultOptions = {};
|
||||||
|
|
||||||
|
function logError(msg) {
|
||||||
|
// @if process.env.LOG_VIDEOJS_I18N='true'
|
||||||
|
console.error(msg);
|
||||||
|
// @endif
|
||||||
|
}
|
||||||
|
|
||||||
function setLabel(controlBar, childName, label) {
|
function setLabel(controlBar, childName, label) {
|
||||||
try {
|
try {
|
||||||
controlBar.getChild(childName).controlText(label);
|
controlBar.getChild(childName).controlText(label);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// We want to be notified, at least on dev, over any structural changes,
|
// We want to be notified, at least on dev, over any structural changes,
|
||||||
// so don't check for null children and let the error surface.
|
// so don't check for null children and let the error surface.
|
||||||
// @if process.env.NODE_ENV!='production'
|
logError(childName + ': ' + e);
|
||||||
console.error(e);
|
|
||||||
// @endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,38 +47,54 @@ function resolveCtrlText(e, player) {
|
||||||
case 'play':
|
case 'play':
|
||||||
setLabel(ctrlBar, 'PlayToggle', __('Pause (space)'));
|
setLabel(ctrlBar, 'PlayToggle', __('Pause (space)'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'pause':
|
case 'pause':
|
||||||
setLabel(ctrlBar, 'PlayToggle', __('Play (space)'));
|
setLabel(ctrlBar, 'PlayToggle', __('Play (space)'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'volumechange':
|
case 'volumechange':
|
||||||
|
try {
|
||||||
ctrlBar
|
ctrlBar
|
||||||
.getChild('VolumePanel')
|
.getChild('VolumePanel')
|
||||||
.getChild('MuteToggle')
|
.getChild('MuteToggle')
|
||||||
.controlText(player.muted() || player.volume() === 0 ? __('Unmute (m)') : __('Mute (m)'));
|
.controlText(player.muted() || player.volume() === 0 ? __('Unmute (m)') : __('Mute (m)'));
|
||||||
|
} catch (e) {
|
||||||
|
logError('MuteToggle: ' + e);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'fullscreenchange':
|
case 'fullscreenchange':
|
||||||
setLabel(ctrlBar, 'FullscreenToggle', player.isFullscreen() ? __('Exit Fullscreen (f)') : __('Fullscreen (f)'));
|
setLabel(ctrlBar, 'FullscreenToggle', player.isFullscreen() ? __('Exit Fullscreen (f)') : __('Fullscreen (f)'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'loadstart':
|
case 'loadstart':
|
||||||
// --- Do everything ---
|
// --- Do everything ---
|
||||||
setLabel(ctrlBar, 'PlaybackRateMenuButton', __('Playback Rate (<, >)'));
|
setLabel(ctrlBar, 'PlaybackRateMenuButton', __('Playback Rate (<, >)'));
|
||||||
setLabel(ctrlBar, 'QualityButton', __('Quality'));
|
setLabel(ctrlBar, 'QualityButton', __('Quality'));
|
||||||
setLabel(ctrlBar, 'PlayNextButton', __('Play Next (SHIFT+N)'));
|
setLabel(ctrlBar, 'PlayNextButton', __('Play Next (SHIFT+N)'));
|
||||||
setLabel(ctrlBar, 'PlayPreviousButton', __('Play Previous (SHIFT+P)'));
|
setLabel(ctrlBar, 'PlayPreviousButton', __('Play Previous (SHIFT+P)'));
|
||||||
|
setLabel(ctrlBar, 'ChaptersButton', __('Chapters'));
|
||||||
|
setLabel(ctrlBar, 'ChromecastButton', __('Open Chromecast menu'));
|
||||||
|
setLabel(ctrlBar, 'FullscreenToggle', player.isFullscreen() ? __('Exit Fullscreen (f)') : __('Fullscreen (f)'));
|
||||||
|
|
||||||
|
try {
|
||||||
ctrlBar
|
ctrlBar
|
||||||
.getChild('VolumePanel')
|
.getChild('VolumePanel')
|
||||||
.getChild('MuteToggle')
|
.getChild('MuteToggle')
|
||||||
.controlText(player.muted() || player.volume() === 0 ? __('Unmute (m)') : __('Mute (m)'));
|
.controlText(player.muted() || player.volume() === 0 ? __('Unmute (m)') : __('Mute (m)'));
|
||||||
|
} catch (e) {
|
||||||
|
logError('MuteToggle: ' + e);
|
||||||
|
}
|
||||||
|
|
||||||
resolveCtrlText({ type: 'play' });
|
resolveCtrlText({ type: 'play' });
|
||||||
resolveCtrlText({ type: 'pause' });
|
resolveCtrlText({ type: 'pause' });
|
||||||
resolveCtrlText({ type: 'volumechange' });
|
resolveCtrlText({ type: 'volumechange' });
|
||||||
resolveCtrlText({ type: 'fullscreenchange' });
|
resolveCtrlText({ type: 'fullscreenchange' });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// @if process.env.NODE_ENV!='production'
|
logError('Unexpected: ' + e.type);
|
||||||
throw Error('Unexpected: ' + e.type);
|
break;
|
||||||
// @endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue