Browse Source

All corrected

WooLNinesun 7 years ago
parent
commit
42efc6b479
3 changed files with 6 additions and 8 deletions
  1. 1 1
      demo/index.html
  2. 4 6
      src/i18n.js
  3. 1 1
      src/option.js

+ 1 - 1
demo/index.html

@@ -25,7 +25,7 @@
                     id: '9E2E3368B56CDBB4',
                     api: 'https://api.prprpr.me/dplayer/',
                     margin: {
-                        bottom:'15%'
+                        bottom: '15%'
                     }
                 }
             });

+ 4 - 6
src/i18n.js

@@ -10,14 +10,12 @@ Use this as shown below..... */
 module.exports = function (lang) {
     this.lang = lang;
     this.tran = (text) => {
-        if (this.lang === 'en-us') {
+        if (tranTxt[this.lang]) {
+            return tranTxt[this.lang][text];
+        }
+        else {
             return text;
         }
-        else if (
-            // add language-code list here
-            this.lang === 'zh-cn' ||
-            this.lang === 'zh-tw'
-        ) { return tranTxt[this.lang][text]; }
     };
 };
 

+ 1 - 1
src/option.js

@@ -13,7 +13,7 @@ module.exports = (option) => {
         autoplay: false,
         theme: '#b7daff',
         loop: false,
-        lang: (navigator.language || navigator.browserLanguage).toLowerCase().indexOf('zh-cn') !== -1 ? 'zh-cn' : 'en-us',
+        lang: (navigator.language || navigator.browserLanguage).toLowerCase(),
         screenshot: false,
         hotkey: true,
         preload: 'auto',