diff --git a/src/locale/lang/en.js b/src/locale/lang/en.js
index ba06a24..4a63758 100644
--- a/src/locale/lang/en.js
+++ b/src/locale/lang/en.js
@@ -113,6 +113,8 @@ export default {
pause: 'Pause',
mute: 'Mute',
nextUp: 'Next Up',
+ translationLyric: 'lyric (trans)',
+ PronunciationLyric: 'lyric (pronounce)',
},
modal: {
close: 'Close',
diff --git a/src/locale/lang/tr.js b/src/locale/lang/tr.js
index bbd1834..296aac3 100644
--- a/src/locale/lang/tr.js
+++ b/src/locale/lang/tr.js
@@ -108,6 +108,8 @@ export default {
pause: 'Durdur',
mute: 'Sesi kapat',
nextUp: 'Sıradaki',
+ translationLyric: 'şarkı sözleri (çeviri)',
+ PronunciationLyric: 'şarkı sözleri (çeviri)',
},
modal: {
close: 'Kapat',
diff --git a/src/locale/lang/zh-CN.js b/src/locale/lang/zh-CN.js
index 42d8998..266fead 100644
--- a/src/locale/lang/zh-CN.js
+++ b/src/locale/lang/zh-CN.js
@@ -114,6 +114,8 @@ export default {
pause: '暂停',
mute: '静音',
nextUp: '播放列表',
+ translationLyric: '歌词(译)',
+ PronunciationLyric: '歌词(音)',
},
modal: {
close: '关闭',
diff --git a/src/locale/lang/zh-TW.js b/src/locale/lang/zh-TW.js
index dd80094..6434199 100644
--- a/src/locale/lang/zh-TW.js
+++ b/src/locale/lang/zh-TW.js
@@ -110,6 +110,8 @@ export default {
pause: '暫停',
mute: '靜音',
nextUp: '播放清單',
+ translationLyric: '歌詞(譯)',
+ PronunciationLyric: '歌詞(音)',
},
modal: {
close: '關閉',
diff --git a/src/utils/lyrics.js b/src/utils/lyrics.js
index fd9919a..b9a7e59 100644
--- a/src/utils/lyrics.js
+++ b/src/utils/lyrics.js
@@ -2,6 +2,7 @@ export function lyricParser(lrc) {
return {
lyric: parseLyric(lrc?.lrc?.lyric || ''),
tlyric: parseLyric(lrc?.tlyric?.lyric || ''),
+ romalyric: parseLyric(lrc?.romalrc?.lyric || ''),
lyricuser: lrc.lyricUser,
transuser: lrc.transUser,
};
diff --git a/src/views/lyrics.vue b/src/views/lyrics.vue
index efe29e9..40acc7f 100644
--- a/src/views/lyrics.vue
+++ b/src/views/lyrics.vue
@@ -201,6 +201,28 @@
>
+
+ 译
+
+
+ 音
+
@@ -215,7 +237,7 @@
>
0 && this.tlyric.length > 0;
+ },
+ lyricToShow() {
+ return this.lyricType === 'translation'
+ ? this.lyricWithTranslation
+ : this.lyricWithRomaPronunciation;
+ },
lyricWithTranslation() {
let ret = [];
// 空内容的去除
@@ -333,6 +365,37 @@ export default {
}
return ret;
},
+ lyricWithRomaPronunciation() {
+ let ret = [];
+ // 空内容的去除
+ const lyricFiltered = this.lyric.filter(({ content }) =>
+ Boolean(content)
+ );
+ // content统一转换数组形式
+ if (lyricFiltered.length) {
+ lyricFiltered.forEach(l => {
+ const { rawTime, time, content } = l;
+ const lyricItem = { time, content, contents: [content] };
+ const sameTimeRomaLyric = this.romalyric.find(
+ ({ rawTime: tLyricRawTime }) => tLyricRawTime === rawTime
+ );
+ if (sameTimeRomaLyric) {
+ const { content: romaLyricContent } = sameTimeRomaLyric;
+ if (content) {
+ lyricItem.contents.push(romaLyricContent);
+ }
+ }
+ ret.push(lyricItem);
+ });
+ } else {
+ ret = lyricFiltered.map(({ time, content }) => ({
+ time,
+ content,
+ contents: [content],
+ }));
+ }
+ return ret;
+ },
lyricFontSize() {
return {
fontSize: `${this.$store.state.settings.lyricFontSize || 28}px`,
@@ -439,9 +502,10 @@ export default {
if (!data?.lrc?.lyric) {
this.lyric = [];
this.tlyric = [];
+ this.romalyric = [];
return false;
} else {
- let { lyric, tlyric } = lyricParser(data);
+ let { lyric, tlyric, romalyric } = lyricParser(data);
lyric = lyric.filter(
l => !/^作(词|曲)\s*(:|:)\s*无$/.exec(l.content)
);
@@ -461,15 +525,27 @@ export default {
if (lyric.length === 1 && includeAM) {
this.lyric = [];
this.tlyric = [];
+ this.romalyric = [];
return false;
} else {
this.lyric = lyric;
this.tlyric = tlyric;
+ this.romalyric = romalyric;
+ if (tlyric.length * romalyric.length > 0) {
+ this.lyricType = 'translation';
+ } else {
+ this.lyricType =
+ lyric.length > 0 ? 'translation' : 'romaPronunciation';
+ }
return true;
}
}
});
},
+ switchLyricType() {
+ this.lyricType =
+ this.lyricType === 'translation' ? 'romaPronunciation' : 'translation';
+ },
formatTrackTime(value) {
return formatTrackTime(value);
},
@@ -758,6 +834,12 @@ export default {
width: 22px;
}
}
+ .lyric-switch-icon {
+ color: var(--color-text);
+ font-size: 14px;
+ line-height: 14px;
+ opacity: 0.88;
+ }
}
}
}