From f99dbac95f983da8439415243a8826080e1093e4 Mon Sep 17 00:00:00 2001
From: BeADre <34639100+BeADre@users.noreply.github.com>
Date: Thu, 22 Oct 2020 14:39:02 +0800
Subject: [PATCH 1/5] fix: add some translations (#36)
* feat: add i18n
* refactor: move songs to common
---
src/locale/lang/en.js | 11 +++++++++--
src/locale/lang/zh-CN.js | 11 +++++++++--
src/utils/filters.js | 4 +++-
src/views/album.vue | 2 +-
src/views/artist.vue | 9 +++++----
src/views/library.vue | 2 +-
src/views/playlist.vue | 2 +-
src/views/search.vue | 4 +++-
8 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/src/locale/lang/en.js b/src/locale/lang/en.js
index 3af4d89..4c71e3a 100644
--- a/src/locale/lang/en.js
+++ b/src/locale/lang/en.js
@@ -31,7 +31,10 @@ export default {
showMore: "SHOW MORE",
showLess: "SHOW LESS",
EPsSingles: "EPs & Singles",
- albums: "Albums"
+ albums: "Albums",
+ withAlbums: "Albums",
+ artist: "Artist",
+ videos: "Music Videos"
},
album: {
released: "Released"
@@ -88,6 +91,10 @@ export default {
song: "Songs",
mv: "MVs",
playlist: "Playlists",
- noResult: "No Results"
+ noResult: "No Results",
+ searchFor: "Search for"
+ },
+ common: {
+ songs: "Songs",
}
};
diff --git a/src/locale/lang/zh-CN.js b/src/locale/lang/zh-CN.js
index 9684433..22ddaf5 100644
--- a/src/locale/lang/zh-CN.js
+++ b/src/locale/lang/zh-CN.js
@@ -31,7 +31,10 @@ export default {
showMore: "显示更多",
showLess: "收起",
EPsSingles: "EP和单曲",
- albums: "专辑"
+ albums: "专辑",
+ withAlbums: "张专辑",
+ artist: "歌手",
+ videos: "个视频"
},
album: {
released: "发行于"
@@ -93,6 +96,10 @@ export default {
song: "歌曲",
mv: "视频",
playlist: "歌单",
- noResult: "暂无结果"
+ noResult: "暂无结果",
+ searchFor: "搜索"
+ },
+ common: {
+ songs: "首歌",
}
};
diff --git a/src/utils/filters.js b/src/utils/filters.js
index 8760dc9..38180da 100644
--- a/src/utils/filters.js
+++ b/src/utils/filters.js
@@ -22,7 +22,9 @@ Vue.filter("formatTime", (Milliseconds, format = "HH:MM:SS") => {
? `${hours}:${mins.padStart(2, "0")}:${seconds}`
: `${mins}:${seconds}`;
} else if (format === "Human") {
- return hours !== "0" ? `${hours} hr ${mins} min` : `${mins} min`;
+ const hoursUnit = locale.locale === "zh-CN" ? "小时" : "hr";
+ const minitesUnit = locale.locale === "zh-CN" ? "分钟" : "min";
+ return hours !== "0" ? `${hours} ${hoursUnit} ${mins} ${minitesUnit}` : `${mins} ${minitesUnit}`;
}
});
diff --git a/src/views/album.vue b/src/views/album.vue
index c9002a7..3a4b213 100644
--- a/src/views/album.vue
+++ b/src/views/album.vue
@@ -27,7 +27,7 @@
{{
new Date(album.publishTime).getFullYear()
}}
- · {{ album.size }} songs,
+ · {{ album.size }} {{ $t("common.songs") }},
{{ albumTime | formatTime("Human") }}
diff --git a/src/views/artist.vue b/src/views/artist.vue
index 44320cf..4325b51 100644
--- a/src/views/artist.vue
+++ b/src/views/artist.vue
@@ -6,10 +6,11 @@
{{ artist.name }}
-
Artist
+
{{ $t("artist.artist") }}
- {{ artist.musicSize }} Songs · {{ artist.albumSize }} Albums ·
- {{ artist.mvSize }} Music Videos
+ {{ artist.musicSize }} {{ $t("common.songs") }} ·
+ {{ artist.albumSize }} {{ $t("artist.withAlbums") }} ·
+ {{ artist.mvSize }} {{ $t("artist.videos") }}
@@ -45,7 +46,7 @@
{{ latestRelease.type | formatAlbumType(latestRelease) }} ·
- {{ latestRelease.size }} Songs
+ {{ latestRelease.size }} {{ $t("common.songs") }}
diff --git a/src/views/library.vue b/src/views/library.vue
index bb9821c..dc63212 100644
--- a/src/views/library.vue
+++ b/src/views/library.vue
@@ -21,7 +21,7 @@
{{ $t("library.likedSongs") }}
- {{ likedSongsPlaylist.trackCount }} songs
+ {{ likedSongsPlaylist.trackCount }} {{ $t("common.songs") }}