diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..fcadb2c
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* text eol=lf
diff --git a/package.json b/package.json
index 28f6120..bf8dd95 100644
--- a/package.json
+++ b/package.json
@@ -43,6 +43,8 @@
"electron-log": "^4.3.0",
"electron-store": "^6.0.1",
"electron-updater": "^4.3.5",
+ "eslint-config-prettier": "^8.1.0",
+ "eslint-plugin-prettier": "^3.3.1",
"express": "^4.17.1",
"express-fileupload": "^1.2.0",
"express-http-proxy": "^1.6.2",
@@ -92,7 +94,8 @@
},
"extends": [
"plugin:vue/essential",
- "eslint:recommended"
+ "eslint:recommended",
+ "plugin:prettier/recommended"
],
"parserOptions": {
"parser": "babel-eslint"
diff --git a/src/background.js b/src/background.js
index 5d2a7c0..a3ce226 100644
--- a/src/background.js
+++ b/src/background.js
@@ -12,7 +12,6 @@ import installExtension, { VUEJS_DEVTOOLS } from "electron-devtools-installer";
import express from "express";
import expressProxy from "express-http-proxy";
import Store from "electron-store";
-import path from "path";
class Background {
constructor() {
diff --git a/src/electron/touchBar.js b/src/electron/touchBar.js
index 7976dab..f4fc825 100644
--- a/src/electron/touchBar.js
+++ b/src/electron/touchBar.js
@@ -10,6 +10,7 @@ export function createTouchBar(window) {
// Icon Resource: https://devimages-cdn.apple.com/design/resources/
function getNativeIcon(name) {
return nativeImage.createFromPath(
+ // eslint-disable-next-line no-undef
path.join(__static, "img/touchbar/", name)
);
}
diff --git a/src/locale/lang/en.js b/src/locale/lang/en.js
index 9337d75..c702e98 100644
--- a/src/locale/lang/en.js
+++ b/src/locale/lang/en.js
@@ -27,6 +27,11 @@ export default {
albums: "Albums",
artists: "Artists",
mvs: "MVs",
+ newPlayList: "New Playlist",
+ userProfileMenu: {
+ settings: "Settings",
+ logout: "Logout",
+ },
},
explore: {
explore: "Explore",
@@ -129,6 +134,8 @@ export default {
automaticallyCacheSongs: "Automatically cache songs",
clearSongsCache: "Clear Songs Cache",
cacheCount: "Cached {song} songs ({size})",
+ showLyricsTranslation: "Show lyrics translation",
+ minimizeToTray: "Minimize to tray",
showGitHubIcon: "Show GitHub icon",
showUnavailableSongInGreyStyle: "Show unavailable song in grey style",
showPlaylistsByAppleMusic: "Show playlists by Apple Music",
diff --git a/src/locale/lang/zh-CN.js b/src/locale/lang/zh-CN.js
index 3b7e0a1..1fcf906 100644
--- a/src/locale/lang/zh-CN.js
+++ b/src/locale/lang/zh-CN.js
@@ -24,6 +24,11 @@ export default {
albums: "专辑",
artists: "艺人",
mvs: "MV",
+ newPlayList: "新建歌单",
+ userProfileMenu: {
+ settings: "设置",
+ logout: "退出登录",
+ },
},
explore: {
explore: "发现",
@@ -130,6 +135,8 @@ export default {
automaticallyCacheSongs: "自动缓存歌曲",
clearSongsCache: "清除歌曲缓存",
cacheCount: "已缓存 {song} 首 ({size})",
+ showLyricsTranslation: "显示歌词翻译",
+ minimizeToTray: "最小化到托盘",
showGitHubIcon: "显示 GitHub 图标",
showUnavailableSongInGreyStyle: "显示不可播放的歌曲为灰色",
showPlaylistsByAppleMusic: "首页显示来自 Apple Music 的歌单",
diff --git a/src/store/index.js b/src/store/index.js
index 4562017..53da26c 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -26,9 +26,10 @@ const options = {
const store = new Vuex.Store(options);
if ([undefined, null].includes(store.state.settings.lang)) {
- let lang = "en";
- if (navigator.language.slice(0, 2) === "zh") lang = "zh-CN";
- store.state.settings.lang = lang;
+ const defaultLang = "en";
+ // when more languages are available, use Map instead of prefer logic
+ const preferChinese = navigator.language.slice(0, 2) === "zh";
+ store.state.settings.lang = preferChinese ? "zh-CN" : defaultLang;
localStorage.setItem("settings", JSON.stringify(store.state.settings));
}
diff --git a/src/views/library.vue b/src/views/library.vue
index ebfeecc..6349515 100644
--- a/src/views/library.vue
+++ b/src/views/library.vue
@@ -80,7 +80,7 @@
icon="plus"
v-show="currentTab === 'playlists'"
@click="openAddPlaylistModal"
- >