移除多余i18n

This commit is contained in:
zhw2590582 committed 2019-11-14 20:50:47 +08:00
1 parent 224a7fe23c
commit c1758c604d
2 files changed
+2 -31

No files matched your search

@@ -3,21 +3,9 @@ import { append, setStyle, setStyles, errorHandle, getExt, vttToBlob, srtToVtt,
export default function localSubtitle(art) {
const {
events: { proxy },
notice,
i18n,
subtitle,
} = art;
const notSupport = 'Only supports subtitle files in .ass, .vtt and .srt format';
i18n.update({
'zh-cn': {
[notSupport]: '只支持 .ass、.vtt 和 .srt 格式的字幕文件',
},
'zh-tw': {
[notSupport]: '只支持 .ass、.vtt 和 .srt 格式的字幕文件',
},
});
function loadSubtitle(file) {
if (file) {
const type = getExt(file.name);
@@ -47,9 +35,7 @@ export default function localSubtitle(art) {
});
reader.readAsText(file);
} else {
const tip = i18n.get(notSupport);
notice.show(tip, true, 3000);
errorHandle(false, tip);
errorHandle(false, 'Only supports subtitle files in .ass, .vtt and .srt format');
}
}
}
+1 -16
View File
@@ -3,33 +3,18 @@ import { append, setStyle, setStyles, errorHandle, getExt } from '../utils';
export default function localVideo(art) {
const {
events: { proxy },
notice,
i18n,
template,
player,
} = art;
const notSupport = 'Playback of this file format is not supported';
i18n.update({
'zh-cn': {
[notSupport]: '不支持播放该文件格式',
},
'zh-tw': {
[notSupport]: '不支持播放該文件格式',
},
});
function loadVideo(file) {
if (file) {
const type = getExt(file.name);
const canPlayType = template.$video.canPlayType(file.type);
if (canPlayType === 'maybe' || canPlayType === 'probably') {
const url = URL.createObjectURL(file);
player.switchUrl(url, file.name);
} else {
const tip = `${i18n.get(notSupport)}: ${file.type || type}`;
notice.show(tip, true, 3000);
errorHandle(false, tip);
errorHandle(false, 'Playback of this file format is not supported');
}
}
}