feat: missing tran undefined

This commit is contained in:
DIYgod 2022-08-15 22:14:06 +01:00
parent 2b6b46e5f6
commit d1c32f66db
No known key found for this signature in database
GPG Key ID: D159328F47A80DCA
3 changed files with 15 additions and 3 deletions

View File

@ -17,8 +17,10 @@ function i18n(lang) {
return tranTxt[this.lang][key];
} else if (tranTxt[this.fallbackLang] && tranTxt[this.fallbackLang][key]) {
return tranTxt[this.fallbackLang][key];
} else {
} else if (standard[key]) {
return standard[key];
} else {
return key;
}
};
}
@ -98,6 +100,8 @@ const standard = {
screenshot: 'Screenshot',
airplay: 'AirPlay',
chromecast: 'ChromeCast',
subtitle: 'Subtitle',
off: 'Off',
'show-subs': 'Show subtitle',
'hide-subs': 'Hide subtitle',
volume: 'Volume',
@ -141,6 +145,8 @@ const tranTxt = {
screenshot: '截图',
airplay: '无线投屏',
chromecast: 'ChromeCast',
subtitle: '字幕',
off: '关闭',
'show-subs': '显示字幕',
'hide-subs': '隐藏字幕',
volume: '音量',
@ -180,6 +186,8 @@ const tranTxt = {
screenshot: '截圖',
airplay: '無線投屏',
chromecast: 'ChromeCast',
subtitle: '字幕',
off: '關閉',
'show-subs': '顯示字幕',
'hide-subs': '隱藏字幕',
volume: '音量',
@ -221,6 +229,8 @@ const tranTxt = {
screenshot: '화면 캡쳐',
airplay: '에어플레이',
chromecast: 'ChromeCast',
subtitle: '부제',
off: '끄다',
'show-subs': '자막 보이기',
'hide-subs': '자막 숨기기',
Volume: '볼륨',
@ -261,6 +271,8 @@ const tranTxt = {
airplay: 'AirPlay',
'show-subs': 'Zeige Untertitel',
chromecast: 'ChromeCast',
subtitle: 'Untertitel',
off: 'Schließung',
'hide-subs': 'Verstecke Untertitel',
volume: 'Lautstärke',
live: 'Live',

View File

@ -66,7 +66,7 @@ class DPlayer {
if (Array.isArray(this.options.subtitle.url)) {
const offSubtitle = {
subtitle: '',
lang: 'Off',
lang: 'off',
};
this.options.subtitle.url.push(offSubtitle);
if (this.options.subtitle.defaultSubtitle) {

View File

@ -139,7 +139,7 @@
</div>
{{ else }}
<div class="dplayer-subtitles">
<button class="dplayer-icon dplayer-subtitles-icon" data-balloon="{{ tran('Subtitle') }}" data-balloon-pos="up">
<button class="dplayer-icon dplayer-subtitles-icon" data-balloon="{{ tran('subtitle') }}" data-balloon-pos="up">
<span class="dplayer-icon-content">{{@ icons.subtitle }}</span>
</button>
<div class="dplayer-subtitles-box">