mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-14 08:26:16 -08:00
移除多余i18n
This commit is contained in:
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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user