fix: Add new localizations (#722)

Co-authored-by: bakerbunker <bakerbunker@nwpu.edu.cn>
This commit is contained in:
BakerBunker 2021-05-30 18:25:35 +08:00 committed by GitHub
parent 5869f889f9
commit 347bc1665d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 40 additions and 17 deletions

View file

@ -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);

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
});