新增调换翻译歌词与罗马音歌词位置设置,优化歌词显示逻辑(#2451)

This commit is contained in:
lyswhut
2025-07-09 08:58:34 +08:00
parent 4c6257c145
commit ad0c0f37c9
14 changed files with 27 additions and 2 deletions
+1
View File
@@ -38,6 +38,7 @@ const defaultSetting: LX.AppSetting = {
'player.isMediaDeviceRemovedStopPlay': false,
'player.isShowLyricTranslation': false,
'player.isShowLyricRoma': false,
'player.isSwapLyricTranslationAndRoma': false,
'player.isS2t': false,
'player.isPlayLxlrc': !isMac,
'player.isSavePlayTime': false,
+5
View File
@@ -159,6 +159,11 @@ declare global {
*/
'player.isShowLyricRoma': boolean
/**
* 是否调换翻译歌词与罗马音歌词位置
*/
'player.isSwapLyricTranslationAndRoma': boolean
/**
* 是否将歌词从简体转换为繁体
*/
+1
View File
@@ -34,6 +34,7 @@ declare namespace LX {
'common.langId': LX.AppSetting['common.langId']
'player.isShowLyricTranslation': LX.AppSetting['player.isShowLyricTranslation']
'player.isShowLyricRoma': LX.AppSetting['player.isShowLyricRoma']
'player.isSwapLyricTranslationAndRoma': LX.AppSetting['player.isSwapLyricTranslationAndRoma']
'player.isPlayLxlrc': LX.AppSetting['player.isPlayLxlrc']
'player.playbackRate': LX.AppSetting['player.playbackRate']
}
+1
View File
@@ -555,6 +555,7 @@
"setting__play_task_bar": "Show playback progress on the taskbar",
"setting__play_timeout": "Timed Pause",
"setting__player_audio_visualization_tip": "The custom audio output device feature conflicts with the audio visualization feature. After the audio visualization is enabled, the audio output device will be reset to the default. At present, this problem cannot be resolved. Do you still want to enable it?",
"setting__player_awap_lyric_trans_roma": "Swap lyric translation and roman",
"setting__search": "Search",
"setting__search_focus_search_box": "Automatically focus search box on startup",
"setting__search_history": "Enable Search History",
+1
View File
@@ -555,6 +555,7 @@
"setting__play_task_bar": "在任务栏上显示当前歌曲播放进度",
"setting__play_timeout": "定时暂停",
"setting__player_audio_visualization_tip": "自定义音频输出设备与音频可视化功能冲突,启用「音频可视化」后音频输出设备将会被重置为默认,目前此问题暂无法解决。是否仍要开启?",
"setting__player_awap_lyric_trans_roma": "调换歌词翻译与歌词罗马音位置",
"setting__search": "搜索设置",
"setting__search_focus_search_box": "启动时自动聚焦搜索框",
"setting__search_history": "显示历史搜索记录",
+1
View File
@@ -555,6 +555,7 @@
"setting__play_task_bar": "在工具列上顯示目前歌曲播放進度",
"setting__play_timeout": "定時暫停",
"setting__player_audio_visualization_tip": "自訂音訊輸出裝置與音訊可視化功能衝突,啟用「音訊可視化」後音訊輸出裝置將會被重設為預設,目前此問題暫無法解決。是否仍要開啟?",
"setting__player_awap_lyric_trans_roma": "調換歌詞翻譯與歌詞羅馬音位置",
"setting__search": "搜尋設定",
"setting__search_focus_search_box": "啟動時自動聚焦搜尋框",
"setting__search_history": "顯示歷史搜尋記錄",
+1
View File
@@ -81,6 +81,7 @@ export const watchConfigKeys = [
'common.langId',
'player.isShowLyricTranslation',
'player.isShowLyricRoma',
'player.isSwapLyricTranslationAndRoma',
'player.isPlayLxlrc',
'player.playbackRate',
] satisfies Array<keyof LX.AppSetting>
+2 -1
View File
@@ -41,8 +41,9 @@ export const setPlaybackRate = (rate: number) => {
export const setLyric = () => {
if (!musicInfo.id) return
const extendedLyrics = []
if (setting['player.isShowLyricTranslation'] && lyrics.tlyric) extendedLyrics.push(lyrics.tlyric)
if (setting['player.isShowLyricRoma'] && lyrics.rlyric) extendedLyrics.push(lyrics.rlyric)
if (setting['player.isShowLyricTranslation'] && lyrics.tlyric) extendedLyrics.push(lyrics.tlyric)
if (setting['player.isSwapLyricTranslationAndRoma']) extendedLyrics.reverse()
lrc.setLyric(
setting['player.isPlayLxlrc'] && lyrics.lxlyric ? lyrics.lxlyric : lyrics.lyric,
extendedLyrics,
+1
View File
@@ -34,6 +34,7 @@ export const setting = shallowReactive<LX.DesktopLyric.Config>({
'common.langId': 'zh-cn',
'player.isShowLyricTranslation': false,
'player.isShowLyricRoma': false,
'player.isSwapLyricTranslationAndRoma': false,
'player.isPlayLxlrc': false,
'player.playbackRate': 1,
})
+1
View File
@@ -6,6 +6,7 @@ import { isPlay, setting } from '@lyric/store/state'
export default () => {
watch(() => setting['player.isShowLyricTranslation'], setLyric)
watch(() => setting['player.isShowLyricRoma'], setLyric)
watch(() => setting['player.isSwapLyricTranslationAndRoma'], setLyric)
watch(() => setting['player.isPlayLxlrc'], setLyric)
watch(() => setting['player.playbackRate'], (rate) => {
setPlaybackRate(rate)
+3 -1
View File
@@ -160,8 +160,10 @@ export const setLyric = () => {
if (!musicInfo.id) return
if (musicInfo.lrc) {
const extendedLyrics = []
if (appSetting['player.isShowLyricTranslation'] && musicInfo.tlrc) extendedLyrics.push(musicInfo.tlrc)
if (appSetting['player.isShowLyricRoma'] && musicInfo.rlrc) extendedLyrics.push(musicInfo.rlrc)
if (appSetting['player.isShowLyricTranslation'] && musicInfo.tlrc) extendedLyrics.push(musicInfo.tlrc)
if (appSetting['player.isSwapLyricTranslationAndRoma']) extendedLyrics.reverse()
lrc.setLyric(
appSetting['player.isPlayLxlrc'] && musicInfo.lxlrc ? musicInfo.lxlrc : musicInfo.lrc,
extendedLyrics,
@@ -25,6 +25,7 @@ export default () => {
watch(() => appSetting['player.isShowLyricTranslation'], setLyric)
watch(() => appSetting['player.isShowLyricRoma'], setLyric)
watch(() => appSetting['player.isSwapLyricTranslationAndRoma'], setLyric)
watch(() => appSetting['player.isPlayLxlrc'], setLyric)
window.app_event.on('play', play)
@@ -14,6 +14,8 @@ dd
base-checkbox(id="setting_player_lyric_transition" :model-value="appSetting['player.isShowLyricTranslation']" :label="$t('setting__play_lyric_transition')" @update:model-value="updateSetting({'player.isShowLyricTranslation': $event})")
.gap-top
base-checkbox(id="setting_player_lyric_roma" :model-value="appSetting['player.isShowLyricRoma']" :label="$t('setting__play_lyric_roma')" @update:model-value="updateSetting({'player.isShowLyricRoma': $event})")
.gap-top
base-checkbox(id="setting_player_awap_lyric_trans_roma" :model-value="appSetting['player.isSwapLyricTranslationAndRoma']" :label="$t('setting__player_awap_lyric_trans_roma')" @update:model-value="updateSetting({'player.isSwapLyricTranslationAndRoma': $event})")
.gap-top
base-checkbox(id="setting_player_auto_skip_on_error" :model-value="appSetting['player.autoSkipOnError']" :label="$t('setting__play_auto_skip_on_error')" @update:model-value="updateSetting({'player.autoSkipOnError': $event})")
.gap-top