fix: add some translations (#36)

* feat: add i18n

* refactor: move songs to common
master
BeADre 4 years ago committed by GitHub
parent e4693b1bdf
commit f99dbac95f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -31,7 +31,10 @@ export default {
showMore: "SHOW MORE", showMore: "SHOW MORE",
showLess: "SHOW LESS", showLess: "SHOW LESS",
EPsSingles: "EPs & Singles", EPsSingles: "EPs & Singles",
albums: "Albums" albums: "Albums",
withAlbums: "Albums",
artist: "Artist",
videos: "Music Videos"
}, },
album: { album: {
released: "Released" released: "Released"
@ -88,6 +91,10 @@ export default {
song: "Songs", song: "Songs",
mv: "MVs", mv: "MVs",
playlist: "Playlists", playlist: "Playlists",
noResult: "No Results" noResult: "No Results",
searchFor: "Search for"
},
common: {
songs: "Songs",
} }
}; };

@ -31,7 +31,10 @@ export default {
showMore: "显示更多", showMore: "显示更多",
showLess: "收起", showLess: "收起",
EPsSingles: "EP和单曲", EPsSingles: "EP和单曲",
albums: "专辑" albums: "专辑",
withAlbums: "张专辑",
artist: "歌手",
videos: "个视频"
}, },
album: { album: {
released: "发行于" released: "发行于"
@ -93,6 +96,10 @@ export default {
song: "歌曲", song: "歌曲",
mv: "视频", mv: "视频",
playlist: "歌单", playlist: "歌单",
noResult: "暂无结果" noResult: "暂无结果",
searchFor: "搜索"
},
common: {
songs: "首歌",
} }
}; };

@ -22,7 +22,9 @@ Vue.filter("formatTime", (Milliseconds, format = "HH:MM:SS") => {
? `${hours}:${mins.padStart(2, "0")}:${seconds}` ? `${hours}:${mins.padStart(2, "0")}:${seconds}`
: `${mins}:${seconds}`; : `${mins}:${seconds}`;
} else if (format === "Human") { } 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}`;
} }
}); });

@ -27,7 +27,7 @@
<span :title="album.publishTime | formatDate">{{ <span :title="album.publishTime | formatDate">{{
new Date(album.publishTime).getFullYear() new Date(album.publishTime).getFullYear()
}}</span> }}</span>
<span> · {{ album.size }} songs</span>, <span> · {{ album.size }} {{ $t("common.songs") }}</span>,
{{ albumTime | formatTime("Human") }} {{ albumTime | formatTime("Human") }}
</div> </div>
<div class="description" @click="showFullDescription = true"> <div class="description" @click="showFullDescription = true">

@ -6,10 +6,11 @@
</div> </div>
<div> <div>
<div class="name">{{ artist.name }}</div> <div class="name">{{ artist.name }}</div>
<div class="artist">Artist</div> <div class="artist">{{ $t("artist.artist") }}</div>
<div class="statistics"> <div class="statistics">
{{ artist.musicSize }} Songs · {{ artist.albumSize }} Albums · {{ artist.musicSize }} {{ $t("common.songs") }} ·
{{ artist.mvSize }} Music Videos {{ artist.albumSize }} {{ $t("artist.withAlbums") }} ·
{{ artist.mvSize }} {{ $t("artist.videos") }}
</div> </div>
<div class="buttons"> <div class="buttons">
<ButtonTwoTone @click.native="playPopularSongs()" :iconClass="`play`"> <ButtonTwoTone @click.native="playPopularSongs()" :iconClass="`play`">
@ -45,7 +46,7 @@
</div> </div>
<div class="type"> <div class="type">
{{ latestRelease.type | formatAlbumType(latestRelease) }} · {{ latestRelease.type | formatAlbumType(latestRelease) }} ·
{{ latestRelease.size }} Songs {{ latestRelease.size }} {{ $t("common.songs") }}
</div> </div>
</div> </div>
</div> </div>

@ -21,7 +21,7 @@
<div class="titles"> <div class="titles">
<div class="title">{{ $t("library.likedSongs") }}</div> <div class="title">{{ $t("library.likedSongs") }}</div>
<div class="sub-title"> <div class="sub-title">
{{ likedSongsPlaylist.trackCount }} songs {{ likedSongsPlaylist.trackCount }} {{ $t("common.songs") }}
</div> </div>
</div> </div>
<button @click.stop="playLikedSongs"> <button @click.stop="playLikedSongs">

@ -37,7 +37,7 @@
<div class="date-and-count"> <div class="date-and-count">
{{ $t("playlist.updatedAt") }} {{ $t("playlist.updatedAt") }}
{{ playlist.updateTime | formatDate }} · {{ playlist.updateTime | formatDate }} ·
{{ playlist.trackCount }} Songs {{ playlist.trackCount }} {{ $t("common.songs") }}
</div> </div>
<div class="description" @click="showFullDescription = true"> <div class="description" @click="showFullDescription = true">
{{ playlist.description }} {{ playlist.description }}

@ -1,6 +1,8 @@
<template> <template>
<div class="search" v-show="show"> <div class="search" v-show="show">
<h1><span>Search for</span> "{{ keywords }}"</h1> <h1>
<span>{{ $t("search.searchFor") }}</span> "{{ keywords }}"
</h1>
<div class="result" v-if="isExistResult"> <div class="result" v-if="isExistResult">
<div class="row"> <div class="row">
<div class="artists" v-if="result.hasOwnProperty('artist')"> <div class="artists" v-if="result.hasOwnProperty('artist')">

Loading…
Cancel
Save