fix: 修改歌名翻译的实现,以避免展示重复的信息 (#958)

* change song translate impl

* i18n

* 修改个变量名

* bug fix?
master
memorydream 3 years ago committed by GitHub
parent de818282c8
commit d424f2cad5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -43,8 +43,8 @@
<span v-if="isAlbum && track.mark === 1318912" class="explicit-symbol" <span v-if="isAlbum && track.mark === 1318912" class="explicit-symbol"
><ExplicitSymbol ><ExplicitSymbol
/></span> /></span>
<span v-if="isTranslate" :title="translate" class="translate"> <span v-if="isSubTitle" :title="subTitle" class="subTitle">
({{ translate }}) ({{ subTitle }})
</span> </span>
</div> </div>
<div v-if="!isAlbum" class="artist"> <div v-if="!isAlbum" class="artist">
@ -124,11 +124,21 @@ export default {
album() { album() {
return this.track.album || this.track.al || this.track?.simpleSong?.al; return this.track.album || this.track.al || this.track?.simpleSong?.al;
}, },
translate() { subTitle() {
let t; let tn = undefined;
if (this.track?.tns?.length > 0) t = this.track.tns[0]; if (
else t = this.track.alia[0]; this.track?.tns?.length > 0 &&
return t; this.track.name !== this.track.tns[0]
) {
tn = this.track.tns[0];
}
//alia
if (this.$store.state.settings.subTitleDefault) {
return this.track?.alia?.length > 0 ? this.track.alia[0] : tn;
} else {
return tn === undefined ? this.track.alia[0] : tn;
}
}, },
type() { type() {
return this.$parent.type; return this.$parent.type;
@ -136,8 +146,12 @@ export default {
isAlbum() { isAlbum() {
return this.type === 'album'; return this.type === 'album';
}, },
isTranslate() { isSubTitle() {
return this.track?.tns?.length > 0 || this.track.alia?.length > 0; return (
(this.track?.tns?.length > 0 &&
this.track.name !== this.track.tns[0]) ||
this.track.alia?.length > 0
);
}, },
isPlaylist() { isPlaylist() {
return this.type === 'playlist'; return this.type === 'playlist';
@ -294,7 +308,7 @@ button {
font-size: 14px; font-size: 14px;
opacity: 0.72; opacity: 0.72;
} }
.translate { .subTitle {
color: #aeaeae; color: #aeaeae;
margin-left: 4px; margin-left: 4px;
} }
@ -398,7 +412,7 @@ button {
.title, .title,
.album, .album,
.time, .time,
.title-and-artist .translate { .title-and-artist .subTitle {
color: var(--color-primary); color: var(--color-primary);
} }
.title .featured, .title .featured,

@ -155,6 +155,7 @@ export default {
enableDiscordRichPresence: 'Enable Discord Rich Presence', enableDiscordRichPresence: 'Enable Discord Rich Presence',
enableGlobalShortcut: 'Enable Global Shortcut', enableGlobalShortcut: 'Enable Global Shortcut',
showLibraryDefault: 'Show library default', showLibraryDefault: 'Show library default',
subTitleDefault: 'Sub title alia default',
lyricsBackground: { lyricsBackground: {
text: 'Show Lyrics Background', text: 'Show Lyrics Background',
off: 'Off', off: 'Off',

@ -150,6 +150,7 @@ export default {
showPlaylistsByAppleMusic: "Apple Music'in Çalma Listelerini Göster", showPlaylistsByAppleMusic: "Apple Music'in Çalma Listelerini Göster",
enableDiscordRichPresence: 'Discord gösterimini aktifleştir', enableDiscordRichPresence: 'Discord gösterimini aktifleştir',
showLibraryDefault: 'Kitaplık Varsayılanını göster', showLibraryDefault: 'Kitaplık Varsayılanını göster',
subTitleDefault: 'Sub title alia default',
lyricsBackground: { lyricsBackground: {
text: 'Şarkı Sözleri Arka Planını Göster', text: 'Şarkı Sözleri Arka Planını Göster',
off: 'kapalı', off: 'kapalı',

@ -156,6 +156,7 @@ export default {
enableDiscordRichPresence: '启用 Discord Rich Presence', enableDiscordRichPresence: '启用 Discord Rich Presence',
enableGlobalShortcut: '启用全局快捷键', enableGlobalShortcut: '启用全局快捷键',
showLibraryDefault: '启动后显示音乐库', showLibraryDefault: '启动后显示音乐库',
subTitleDefault: '副标题使用别名',
lyricsBackground: { lyricsBackground: {
text: '显示歌词背景', text: '显示歌词背景',
off: '关闭', off: '关闭',

@ -153,6 +153,7 @@ export default {
enableDiscordRichPresence: '啟用 Discord Rich Presence', enableDiscordRichPresence: '啟用 Discord Rich Presence',
enableGlobalShortcut: '啟用全域快捷鍵', enableGlobalShortcut: '啟用全域快捷鍵',
showLibraryDefault: '啟動後顯示音樂庫', showLibraryDefault: '啟動後顯示音樂庫',
subTitleDefault: '副標題使用別名',
lyricsBackground: { lyricsBackground: {
text: '顯示歌詞背景', text: '顯示歌詞背景',
off: '關閉', off: '關閉',

@ -26,6 +26,7 @@ let localStorage = {
enableDiscordRichPresence: false, enableDiscordRichPresence: false,
enableGlobalShortcut: true, enableGlobalShortcut: true,
showLibraryDefault: false, showLibraryDefault: false,
subTitleDefault: false,
enabledPlaylistCategories, enabledPlaylistCategories,
proxyConfig: { proxyConfig: {
protocol: 'noProxy', protocol: 'noProxy',

@ -337,6 +337,24 @@
</div> </div>
</div> </div>
</div> </div>
<div class="item">
<div class="left">
<div class="title">{{ $t('settings.subTitleDefault') }}</div>
</div>
<div class="right">
<div class="toggle">
<input
id="sub-title-default"
v-model="subTitleDefault"
type="checkbox"
name="sub-title-default"
/>
<label for="sub-title-default"></label>
</div>
</div>
</div>
<div class="item"> <div class="item">
<div class="left"> <div class="left">
<div class="title" style="transform: scaleX(-1)">🐈 🏳🌈</div> <div class="title" style="transform: scaleX(-1)">🐈 🏳🌈</div>
@ -747,6 +765,17 @@ export default {
}); });
}, },
}, },
subTitleDefault: {
get() {
return this.settings.subTitleDefault;
},
set(value) {
this.$store.commit('updateSettings', {
key: 'subTitleDefault',
value,
});
},
},
enableGlobalShortcut: { enableGlobalShortcut: {
get() { get() {
return this.settings.enableGlobalShortcut; return this.settings.enableGlobalShortcut;

Loading…
Cancel
Save