fix: Add new localizations (#722)

Co-authored-by: bakerbunker <bakerbunker@nwpu.edu.cn>
master
BakerBunker 4 years ago committed by GitHub
parent 5869f889f9
commit 347bc1665d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -18,6 +18,7 @@
</template>
<script>
import locale from '@/locale';
import { mapMutations, mapState, mapActions } from 'vuex';
import { dailyRecommendTracks } from '@/api/playlist';
import { isAccountLoggedIn } from '@/utils/auth';
@ -61,7 +62,7 @@ export default {
},
playDailyTracks() {
if (!isAccountLoggedIn()) {
this.showToast('此操作需要登录网易云账号');
this.showToast(locale.t('toast.needToLogin'));
return;
}
let trackIDs = this.dailyTracks.map(t => t.id);

@ -30,6 +30,7 @@
<script>
import { mapActions, mapMutations, mapState } from 'vuex';
import Modal from '@/components/Modal.vue';
import locale from '@/locale';
import { addOrRemoveTrackFromPlaylist } from '@/api/playlist';
import { disableScrolling, enableScrolling } from '@/utils/ui';
@ -84,7 +85,7 @@ export default {
}).then(data => {
if (data.body.code === 200) {
this.show = false;
this.showToast('已添加到歌单');
this.showToast(locale.t('toast.savedToPlaylist'));
} else {
this.showToast(data.body.message);
}

@ -30,6 +30,7 @@
<script>
import Modal from '@/components/Modal.vue';
import locale from '@/locale';
import { mapMutations, mapState, mapActions } from 'vuex';
import { createPlaylist, addOrRemoveTrackFromPlaylist } from '@/api/playlist';
import { disableScrolling, enableScrolling } from '@/utils/ui';
@ -86,7 +87,7 @@ export default {
tracks: this.modals.newPlaylistModal.afterCreateAddTrackID,
}).then(data => {
if (data.body.code === 200) {
this.showToast('已添加到歌单');
this.showToast(locale.t('toast.savedToPlaylist'));
} else {
this.showToast(data.body.message);
}

@ -32,7 +32,9 @@
@click="removeTrackFromPlaylist"
>从歌单中删除</div
>
<div class="item" @click="addTrackToPlaylist"></div>
<div class="item" @click="addTrackToPlaylist">{{
$t('contextMenu.addToPlaylist')
}}</div>
</ContextMenu>
<div :style="listStyles">
<TrackListItem
@ -54,6 +56,7 @@ import { isAccountLoggedIn } from '@/utils/auth';
import TrackListItem from '@/components/TrackListItem.vue';
import ContextMenu from '@/components/ContextMenu.vue';
import locale from '@/locale';
export default {
name: 'TrackList',
@ -183,7 +186,7 @@ export default {
},
addTrackToPlaylist() {
if (!isAccountLoggedIn()) {
this.showToast('此操作需要登录网易云账号');
this.showToast(locale.t('toast.needToLogin'));
return;
}
this.updateModal({
@ -199,7 +202,7 @@ export default {
},
removeTrackFromPlaylist() {
if (!isAccountLoggedIn()) {
this.showToast('此操作需要登录网易云账号');
this.showToast(locale.t('toast.needToLogin'));
return;
}
if (confirm(`确定要从歌单删除 ${this.rightClickedTrack.name}`)) {
@ -210,7 +213,9 @@ export default {
tracks: trackID,
}).then(data => {
this.showToast(
data.body.code === 200 ? '已从歌单中删除' : data.body.message
data.body.code === 200
? locale.t('toast.removedFromPlaylist')
: data.body.message
);
this.$parent.removeTrack(trackID);
});

@ -168,12 +168,16 @@ export default {
saveToLibrary: 'Save to library',
removeFromLibrary: 'Remove from library',
addToPlaylist: 'Add to playlist',
searchInPlaylist: 'Search in playlist',
copyUrl: 'Copy URL',
},
toast: {
savedToPlaylist: 'Saved to playlist',
removedFromPlaylist: 'Removed from playlist',
savedToMyLikedSongs: 'Saved to my Liked Songs',
removedFromMyLikedSongs: 'Removed from my Liked Songs',
copied: 'Copied',
copyFailed: 'Copy failed: ',
needToLogin: 'Need to log into netease account',
},
};

@ -169,12 +169,16 @@ export default {
saveToLibrary: '保存到音乐库',
removeFromLibrary: '从音乐库删除',
addToPlaylist: '添加到歌单',
searchInPlaylist: '歌单内搜索',
copyUrl: '复制链接',
},
toast: {
savedToPlaylist: '已添加到歌单',
removedFromPlaylist: '已从歌单中删除',
savedToMyLikedSongs: '已添加到我喜欢的音乐',
removedFromMyLikedSongs: '已从喜欢的音乐中删除',
copied: '已复制',
copyFailed: '复制失败:',
needToLogin: '此操作需要登录网易云帐号',
},
};

@ -217,7 +217,7 @@ export default {
},
likeAlbum(toast = false) {
if (!isAccountLoggedIn()) {
this.showToast('此操作需要登录网易云账号');
this.showToast(locale.t('toast.needToLogin'));
return;
}
likeAAlbum({

@ -312,7 +312,7 @@ export default {
},
followArtist() {
if (!isAccountLoggedIn()) {
this.showToast('此操作需要登录网易云账号');
this.showToast(locale.t('toast.needToLogin'));
return;
}
followAArtist({

@ -136,6 +136,7 @@ import { getLyric } from '@/api/track';
import { randomNum, dailyTask } from '@/utils/common';
import { isAccountLoggedIn } from '@/utils/auth';
import NProgress from 'nprogress';
import locale from '@/locale';
import ContextMenu from '@/components/ContextMenu.vue';
import TrackList from '@/components/TrackList.vue';
@ -228,7 +229,7 @@ export default {
},
updateCurrentTab(tab) {
if (!isAccountLoggedIn() && tab !== 'playlists') {
this.showToast('此操作需要登录网易云账号');
this.showToast(locale.t('toast.needToLogin'));
return;
}
this.currentTab = tab;
@ -247,7 +248,7 @@ export default {
},
openAddPlaylistModal() {
if (!isAccountLoggedIn()) {
this.showToast('此操作需要登录网易云账号');
this.showToast(locale.t('toast.needToLogin'));
return;
}
this.updateModal({

@ -35,6 +35,7 @@
import { mvDetail, mvUrl, simiMv, likeAMV } from '@/api/mv';
import { isAccountLoggedIn } from '@/utils/auth';
import NProgress from 'nprogress';
import locale from '@/locale';
import '@/assets/css/plyr.css';
import Plyr from 'plyr';
@ -116,7 +117,7 @@ export default {
},
likeMV() {
if (!isAccountLoggedIn()) {
this.showToast('此操作需要登录网易云账号');
this.showToast(locale.t('toast.needToLogin'));
return;
}
likeAMV({

@ -186,9 +186,13 @@
<ContextMenu ref="playlistMenu">
<!-- <div class="item">{{ $t('contextMenu.addToQueue') }}</div> -->
<div class="item" @click="likePlaylist(true)">{{
playlist.subscribed ? '从音乐库删除' : '保存到音乐库'
playlist.subscribed
? $t('contextMenu.removeFromLibrary')
: $t('contextMenu.saveToLibrary')
}}</div>
<div class="item" @click="searchInPlaylist()">{{
$t('contextMenu.searchInPlaylist')
}}</div>
<div class="item" @click="searchInPlaylist()"></div>
<div
v-if="playlist.creator.userId === data.user.userId"
class="item"
@ -216,6 +220,7 @@ import {
import { getTrackDetail } from '@/api/track';
import { isAccountLoggedIn } from '@/utils/auth';
import nativeAlert from '@/utils/nativeAlert';
import locale from '@/locale';
import { disableScrolling, enableScrolling } from '@/utils/ui';
import ButtonTwoTone from '@/components/ButtonTwoTone.vue';
@ -409,7 +414,7 @@ export default {
},
likePlaylist(toast = false) {
if (!isAccountLoggedIn()) {
this.showToast('此操作需要登录网易云账号');
this.showToast(locale.t('toast.needToLogin'));
return;
}
subscribePlaylist({
@ -486,7 +491,7 @@ export default {
},
deletePlaylist() {
if (!isAccountLoggedIn()) {
this.showToast('此操作需要登录网易云账号');
this.showToast(locale.t('toast.needToLogin'));
return;
}
let confirmation = confirm(`确定要删除歌单 ${this.playlist.name}`);
@ -517,7 +522,7 @@ export default {
},
removeTrack(trackID) {
if (!isAccountLoggedIn()) {
this.showToast('此操作需要登录网易云账号');
this.showToast(locale.t('toast.needToLogin'));
return;
}
this.tracks = this.tracks.filter(t => t.id !== trackID);

Loading…
Cancel
Save