From ebbf78fddbe7f6caa95f9ac7bcc67b315a97b614 Mon Sep 17 00:00:00 2001 From: kunkka Date: Mon, 19 Oct 2020 22:34:34 +0800 Subject: [PATCH] feat: integrate vue-i18n --- src/components/Footer.vue | 2 +- src/components/Navbar.vue | 9 +-- src/locale/messages.js | 154 ++++++++++++++++++++++++++++++++---- src/views/album.vue | 7 +- src/views/artist.vue | 14 ++-- src/views/explore.vue | 4 +- src/views/home.vue | 25 +++--- src/views/library.vue | 6 +- src/views/login.vue | 10 ++- src/views/loginAccount.vue | 18 ++--- src/views/loginUsername.vue | 10 +-- src/views/mv.vue | 2 +- src/views/newAlbum.vue | 2 +- src/views/next.vue | 4 +- src/views/playlist.vue | 6 +- src/views/search.vue | 2 +- 16 files changed, 196 insertions(+), 79 deletions(-) diff --git a/src/components/Footer.vue b/src/components/Footer.vue index 8df7833..b639e81 100644 --- a/src/components/Footer.vue +++ b/src/components/Footer.vue @@ -1,7 +1,7 @@ diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue index c14eb35..4c176b5 100644 --- a/src/components/Navbar.vue +++ b/src/components/Navbar.vue @@ -10,17 +10,17 @@
@@ -32,7 +32,7 @@
YesPlayMusic's GitHub repository to build and use the self-hosted NetEase Cloud API.` + }, + mv: { + moreVideo: 'More Videos' + }, + next: { + nowPlaying: 'Now Playing', + nextUp: 'Next Up' + }, + playlist: "Playlists", + play: "PLAY", + likedSong: "Liked Songs", + shortIs: "'s", + is: "'s", + updatedAt: "Updated at", }, - 'zh-CN': { - message: { - home: '首页', - explore: '发现', - library: '歌单', - search: '搜索' - } + "zh-CN": { + nav: { + home: "首页", + explore: "发现", + library: "歌单", + search: "搜索" + }, + footer: { + settings: '设置', + }, + home: { + recommendPlaylist: "推荐歌单", + recommendArtist: "推荐歌手", + newAlbum: "新专速递", + leaderboard: "排行榜", + seeMore: "更多", + }, + library: "歌单", + explore: { + explore: "发现", + loadMore: "加载更多", + }, + artist: { + latestRelease: "最新发布", + popularSongs: "热门歌曲", + showMore: "显示更多", + showLess: "收起", + EPSingle: "专辑及单曲", + albums: "专辑" + }, + album: { + released: "发布于", + }, + login: { + accessToAll: "可访问全部数据", + loginText: "登录网易云账号", + search: "搜索网易云账号", + readonly: "只能读取账号公开数据", + usernameLogin: '用户名登录', + searchHolder: "请输入你的网易云用户名", + enterTip: "按 Enter 搜索", + choose: "在列表中选中你的账号", + confirm: "确认", + countrycode: '国际区号', + phone: '手机号', + email: '邮箱', + password: '密码', + login: '登录', + usingEmail: '使用邮箱登录', + usingPhone: '使用手机号登录', + // TODO + agreement: `YesPlayMusic 承诺不会保存你的任何账号信息到云端。
+ 你的密码会在本地进行 MD5 加密后再传输到网易云 API。
+ YesPlayMusic 并非网易云官方网站,输入账号信息前请慎重考虑。 你也可以前往 + YesPlayMusic 的 GitHub 源代码仓库 + 自行构建并使用自托管的网易云 API。` + }, + mv: { + moreVideo: '更多视频' + }, + next: { + nowPlaying: '正在播放', + nextUp: '即将播放' + }, + playlist: "播放列表", + play: "播放", + likedSong: "我喜欢的音乐", + shortIs: "", + is: "的", + updatedAt: "更新于" } -}; +}; \ No newline at end of file diff --git a/src/views/album.vue b/src/views/album.vue index d24563b..a0d21dd 100644 --- a/src/views/album.vue +++ b/src/views/album.vue @@ -38,24 +38,21 @@ @click.native="playAlbumByID(album.id)" :iconClass="`play`" > - PLAY + {{ $t('play') }}
- -
- Released {{ album.publishTime | formatDate("MMMM D, YYYY") }} + {{ $t("album.released") }} {{ album.publishTime | formatDate("MMMM D, YYYY") }}
-
- PLAY + {{ $t('play') }}
-
Latest Release
+
{{ $t('artist.latestRelease') }}
-
Albums
+
{{ $t('artist.album') }}
-
EPs & Singles
+
{{ $t('artist.EPSingle') }}
-

Explore

+

{{ $t('explore.explore') }}

Load More{{ $t('explore.loadMore') }}
diff --git a/src/views/home.vue b/src/views/home.vue index 78fe867..71d3695 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -11,11 +11,10 @@ :imageSize="1024" />
-
- {{ recommendPlaylist.name }} - SEE MORE + {{ $t("home.recommendPlaylist") }} + {{ $t("home.seeMore") }}
-
-
{{ recommendArtists.name }}
+
{{ $t("home.recommendArtist") }}
-
- {{ newReleasesAlbum.name }} - SEE MORE + {{ $t("home.newAlbum") }} + {{ $t("home.seeMore") }}
-
- {{ topList.name }} - SEE MORE + {{ $t("home.leaderboard") }} + {{ $t("home.seeMore") }}
{{ user.profile.nickname - }}'s Library + }}{{ $t("is") }} {{ $t("library") }}
@@ -19,7 +19,7 @@
-
Liked Songs
+
{{ $t("likedSong") }}
{{ likedSongsPlaylist.trackCount }} songs
@@ -41,7 +41,7 @@
-
Playlists
+
{{ $t("playlist") }}
-
登录网易云账号
-
可访问全部数据
+
{{ $t('login.loginText') }}
+
{{ $t('login.accessToAll') }}
@@ -28,8 +28,8 @@ >
-
搜索网易云账号
-
只能读取账号公开数据
+
{{ $t('login.search') }}
+
{{ $t('login.readonly') }}
@@ -105,6 +105,8 @@ export default { height: 128px; width: 300px; transition: all 0.3s; + padding-left: 22px; + box-sizing: border-box; .active { .title-info { diff --git a/src/views/loginAccount.vue b/src/views/loginAccount.vue index 8edfd64..b6cc11a 100644 --- a/src/views/loginAccount.vue +++ b/src/views/loginAccount.vue @@ -3,7 +3,7 @@
-
登录网易云账号
+
{{ $t("login.loginText") }}
@@ -11,14 +11,14 @@
- +
YesPlayMusic 承诺不会保存你的任何账号信息到云端。
@@ -112,7 +112,7 @@ export default { methods: { ...mapMutations(["updateUser", "updateUserInfo"]), afterLogin() { - Cookies.set("MUSIC_U", true, { expires: 3650 }); + // Cookies.set("MUSIC_U", true, { expires: 3650 }); Cookies.set("loginMode", "account", { expires: 3650 }); userPlaylist({ uid: this.$store.state.settings.user.userId, diff --git a/src/views/loginUsername.vue b/src/views/loginUsername.vue index 4683b77..3b4f809 100644 --- a/src/views/loginUsername.vue +++ b/src/views/loginUsername.vue @@ -1,14 +1,14 @@