Skip to content

Commit

Permalink
fix i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Jul 20, 2016
1 parent 69cdaba commit 621b7b1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ var option = {
autoplay: false, // Optional, autoplay video, not supported by mobile browsers
theme: '#FADFA3', // Optional, theme color, default: #b7daff
loop: true, // Optional, loop play music, default: true
lang: 'zh', // Optional, language, `zh` for Chinese, `en` for English, default: en
lang: 'zh', // Optional, language, `zh` for Chinese, `en` for English, default: Navigator language
video: { // Required, video info
url: '若能绽放光芒.mp4', // Required, video url
pic: '若能绽放光芒.png' // Optional, music picture
url: '若能绽放光芒.mp4', // Required, video url
pic: '若能绽放光芒.png' // Optional, music picture
},
danmaku: { // Optional, showing danmaku
id: '9E2E3368B56CDBB4', // Required, danmaku id, MUST BE UNIQUE, CAN NOT USE THESE IN YOUR NEW PLAYER: `https://dplayer.daoapp.io/list`
Expand Down
6 changes: 3 additions & 3 deletions dist/DPlayer.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/DPlayer.min.js.map

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions src/DPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class DPlayer {
autoplay: false,
theme: '#b7daff',
loop: false,
lang: 'en'
lang: navigator.language.indexOf('zh') !== -1 ? 'zh' : 'en'
};
for (let defaultKey in defaultOption) {
if (defaultOption.hasOwnProperty(defaultKey) && !option.hasOwnProperty(defaultKey)) {
Expand All @@ -70,7 +70,9 @@ class DPlayer {
'Speed': '速度',
'Opacity for danmaku': '弹幕透明度',
'Normal': '正常',
'Please input danmaku!': '要输入弹幕内容啊喂!'
'Please input danmaku!': '要输入弹幕内容啊喂!',
'Set danmaku color': '设置弹幕颜色',
'Set danmaku type': '设置弹幕类型'
};
this.getTran = (text) => {
if (this.option.lang === 'en') {
Expand Down Expand Up @@ -205,7 +207,7 @@ class DPlayer {
+ ` </button>
<div class="dplayer-comment-setting-box">
<div class="dplayer-comment-setting-color">
<div class="dplayer-comment-setting-title">设置弹幕颜色</div>
<div class="dplayer-comment-setting-title">${this.getTran('Set danmaku color')}</div>
<label>
<input type="radio" name="dplayer-danmaku-color" value="#fff" checked>
<span style="background: #fff; border: 1px solid rgba(0,0,0,.1);"></span>
Expand All @@ -232,7 +234,7 @@ class DPlayer {
</label>
</div>
<div class="dplayer-comment-setting-type">
<div class="dplayer-comment-setting-title">设置弹幕类型</div>
<div class="dplayer-comment-setting-title">${this.getTran('Set danmaku type')}</div>
<label>
<input type="radio" name="dplayer-danmaku-type" value="top">
<span>${this.getTran('Top')}</span>
Expand Down

0 comments on commit 621b7b1

Please sign in to comment.