feat: use vue-i18n for language switch (#23)

* feat: add config to resolve path alias.

* feat: use vue-i18n for language switch

* feat: add .editorconfig for ide

* fix: add no-referrer to avoid CROB

* fix: setCookie and fix typo

* feat: integrate vue-i18n
This commit is contained in:
Hawtim Zhang 2020-10-19 23:14:26 +08:00 committed by GitHub
parent 00774d3a91
commit ecee495a18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 246 additions and 65 deletions

12
src/locale/index.js Normal file
View file

@ -0,0 +1,12 @@
import Vue from 'vue';
import VueI18n from 'vue-i18n'
import messages from './messages';
Vue.use(VueI18n)
const i18n = new VueI18n({
locale: 'zh-CN',
messages
});
export default i18n;

144
src/locale/messages.js Normal file
View file

@ -0,0 +1,144 @@
export default {
en: {
nav: {
home: "Home",
explore: "Explore",
library: "Library",
search: "Search"
},
footer: {
settings: 'Settings',
},
home: {
recommendPlaylist: "Recommended Playlist",
recommendArtist: "Recommended Artist",
newAlbum: "Lastest Album",
leaderboard: "Leaderboard",
seeMore: "SEE MORE",
},
library: "Library",
explore: {
explore: "Explore",
loadMore: "Load More",
},
artist: {
latestRelease: "Latest Release",
popularSongs: "Popular Songs",
showMore: "SHOW MORE",
showLess: "SHOW LESS",
EPSingle: "EPs & Singles",
albums: "Albums"
},
album: {
released: "Released",
},
login: {
accessToAll: "Access to all data",
loginText: "Login in Netease",
search: "Search account",
readonly: "Only access to public data",
usernameLogin: "Username Login",
searchHolder: "Your account username",
enterTip: "Press 'enter' to search",
choose: "Choose your account",
confirm: "confirm",
countrycode: 'countrycode',
phone: 'phone',
email: 'email',
password: 'password',
login: 'Login',
usingEmail: 'Using email',
usingPhone: 'Using phone',
// TODO
agreement: `YesPlayMusic promises not to save any of your account information to the cloud.
Your password will be MD5 encrypted locally and then transmitted to NetEase Cloud API.
YesPlayMusic is not the official website of NetEase Cloud, please consider carefully before entering account information. You can also go to <a href="https://github.com/qier222/YesPlayMusic">YesPlayMusic's GitHub repository</a> 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": {
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 承诺不会保存你的任何账号信息到云端。<br />
你的密码会在本地进行 MD5 加密后再传输到网易云 API<br />
YesPlayMusic 并非网易云官方网站输入账号信息前请慎重考虑 你也可以前往
<a href="https://github.com/qier222/YesPlayMusic"
>YesPlayMusic GitHub 源代码仓库</a
>
自行构建并使用自托管的网易云 API`
},
mv: {
moreVideo: '更多视频'
},
next: {
nowPlaying: '正在播放',
nextUp: '即将播放'
},
playlist: "播放列表",
play: "播放",
likedSong: "我喜欢的音乐",
shortIs: "",
is: "的",
updatedAt: "更新于"
}
};