Skip to content

Commit

Permalink
feat: added german translation and in the process a new translation s…
Browse files Browse the repository at this point in the history
…ystem, close #1221, credit @Totto16
  • Loading branch information
DIYgod committed Aug 15, 2022
1 parent b429b9a commit ef273ec
Show file tree
Hide file tree
Showing 8 changed files with 285 additions and 160 deletions.
3 changes: 2 additions & 1 deletion demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function initPlayers() {
logo: 'https://i.loli.net/2019/06/06/5cf8c5d94521136430.png',
volume: 0.2,
mutex: true,
lang: 'zh-cn',
video: {
url: 'https://api.dogecloud.com/player/get.mp4?vcode=5ac682e6f8231991&userId=17&ext=.mp4',
pic: 'https://i.loli.net/2019/06/06/5cf8c5d9c57b510947.png',
Expand Down Expand Up @@ -140,7 +141,7 @@ function initPlayers() {
const eventsEle = document.getElementById('events');
for (let i = 0; i < events.length; i++) {
dp2.on(events[i], (info) => {
eventsEle.innerHTML += '<p>Event: ' + events[i] + '</p>';
eventsEle.innerHTML += `<p>Event: ${events[i]} ${info?`Data: <span>${JSON.stringify(info)}</span>`:''}</p>`;
eventsEle.scrollTop = eventsEle.scrollHeight;
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Comment {

// text can't be empty
if (!this.player.template.commentInput.value.replace(/^\s+|\s+$/g, '')) {
this.player.notice(this.player.tran('Please input danmaku content!'));
this.player.notice(this.player.tran('please-input-danmaku'));
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,12 @@ class Controller {
initSubtitleButton() {
if (this.player.options.subtitle) {
this.player.events.on('subtitle_show', () => {
this.player.template.subtitleButton.dataset.balloon = this.player.tran('Hide subtitle');
this.player.template.subtitleButton.dataset.balloon = this.player.tran('hide-subs');
this.player.template.subtitleButtonInner.style.opacity = '';
this.player.user.set('subtitle', 1);
});
this.player.events.on('subtitle_hide', () => {
this.player.template.subtitleButton.dataset.balloon = this.player.tran('Show subtitle');
this.player.template.subtitleButton.dataset.balloon = this.player.tran('show-subs');
this.player.template.subtitleButtonInner.style.opacity = '0.4';
this.player.user.set('subtitle', 0);
});
Expand Down
4 changes: 2 additions & 2 deletions src/js/danmaku.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Danmaku {
}
},
error: (msg) => {
this.options.error(msg || this.options.tran('Danmaku load failed'));
this.options.error(msg || this.options.tran('danmaku-failed'));
results[i] = [];

++readCount;
Expand All @@ -97,7 +97,7 @@ class Danmaku {
data: danmakuData,
success: callback,
error: (msg) => {
this.options.error(msg || this.options.tran('Danmaku send failed'));
this.options.error(msg || this.options.tran('danmaku-failed'));
},
});

Expand Down
Loading

0 comments on commit ef273ec

Please # to comment.