From d1c32f66db4aae0e2902e871d9f8df52eb5ec94c Mon Sep 17 00:00:00 2001 From: DIYgod Date: Mon, 15 Aug 2022 22:14:06 +0100 Subject: [PATCH] feat: missing tran undefined --- src/js/i18n.js | 14 +++++++++++++- src/js/player.js | 2 +- src/template/player.art | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/js/i18n.js b/src/js/i18n.js index cbecd87..d969bfe 100644 --- a/src/js/i18n.js +++ b/src/js/i18n.js @@ -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', diff --git a/src/js/player.js b/src/js/player.js index fcbf31f..6ee0199 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -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) { diff --git a/src/template/player.art b/src/template/player.art index 4e54151..3a8bbc9 100644 --- a/src/template/player.art +++ b/src/template/player.art @@ -139,7 +139,7 @@ {{ else }}
-