diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index f8108ccb..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "src/cider-i18n"] - path = src/cider-i18n - url = https://github.com/ciderapp/cider-i18n diff --git a/crowdin.yml b/crowdin.yml deleted file mode 100644 index 3ce3bcbd..00000000 --- a/crowdin.yml +++ /dev/null @@ -1,3 +0,0 @@ -files: - - source: /src/i18n/source/en_US.json - translation: /src/i18n/%locale_with_underscore%.json diff --git a/package.json b/package.json index e9139f7e..c553b3cb 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ }, "dependencies": { "@achingbrain/ssdp": "^4.0.4", + "@crowdin/ota-client": "^1.0.0", "@sentry/electron": "^4.6.0", "@sentry/integrations": "^7.54.0", "adm-zip": "^0.5.10", diff --git a/src/cider-i18n b/src/cider-i18n deleted file mode 160000 index 1a427976..00000000 --- a/src/cider-i18n +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1a427976edb6c19bf16620c15cba75f5052f7313 diff --git a/src/main/base/browserwindow.ts b/src/main/base/browserwindow.ts index b8f5c6ba..ce8675b7 100644 --- a/src/main/base/browserwindow.ts +++ b/src/main/base/browserwindow.ts @@ -1048,22 +1048,19 @@ export class BrowserWindow { }); ipcMain.on("get-i18n-listing", (event) => { - console.debug("[i18n] Getting i18n listing from " + utils.getPath("i18nPath")); - const i18nFiles = readdirSync(utils.getPath("i18nPath")).filter((file) => file.endsWith(".json")), - i18nListing = []; + const translations = utils.i18n + const i18nListing: any = []; - for (let i = 0; i < i18nFiles.length; i++) { - if (i18nFiles[i] == "index.json") continue; - console.debug("[i18n] Processing file: " + join(utils.getPath("i18nPath"), i18nFiles[i])); - const i18n: { [index: string]: Object } = JSON.parse(readFileSync(join(utils.getPath("i18nPath"), i18nFiles[i]), "utf8")); + for (const lang in translations) { i18nListing.push({ - code: i18nFiles[i].replace(".json", ""), - nameNative: i18n["i18n.languageName"] ?? i18nFiles[i].replace(".json", ""), - nameEnglish: i18n["i18n.languageNameEnglish"] ?? i18nFiles[i].replace(".json", ""), - category: i18n["i18n.category"] ?? "", - authors: i18n["i18n.authors"] ?? "", + code: lang, + nameNative: translations[lang][0].content["i18n.languageName"] ?? lang, + nameEnglish: translations[lang][0].content["i18n.languageNameEnglish"] ?? lang, + category: translations[lang][0].content["i18n.category"] ?? "", + authors: translations[lang][0].content["i18n.authors"] ?? "", }); } + event.returnValue = i18nListing; }); diff --git a/src/main/base/utils.ts b/src/main/base/utils.ts index dc828c7c..0a50ce3e 100644 --- a/src/main/base/utils.ts +++ b/src/main/base/utils.ts @@ -3,10 +3,14 @@ import * as path from "path"; import { Store } from "./store"; import { BrowserWindow as bw } from "./browserwindow"; import { app, BrowserWindow, ipcMain } from "electron"; +import OtaClient from "@crowdin/ota-client"; import fetch from "electron-fetch"; import ElectronStore from "electron-store"; export class utils { + static crowdinClient: OtaClient = new OtaClient('fda9a6528649ea90dee35390wog') + static i18n: any = {}; + /** * Playback Functions */ @@ -38,8 +42,6 @@ export class utils { rendererPath: path.join(__dirname, "../../src/renderer"), mainPath: path.join(__dirname, "../../src/main"), resourcePath: path.join(__dirname, "../../resources"), - i18nPath: path.join(__dirname, "../../src/cider-i18n"), - i18nPathSrc: path.join(__dirname, "../../src/il8n/source"), ciderCache: path.resolve(app.getPath("userData"), "CiderCache"), themes: path.resolve(app.getPath("userData"), "Themes"), plugins: path.resolve(app.getPath("userData"), "Plugins"), @@ -102,6 +104,11 @@ export class utils { return await fetch(url, opts); } } + + static async initializeTranslations() { + this.i18n = await this.crowdinClient.getTranslations() + } + /** * Fetches the i18n locale for the given language. * @param language {string} The language to fetch the locale for. @@ -109,23 +116,12 @@ export class utils { * @returns {string | Object} The locale value. */ static getLocale(language: string, key?: string): string | object { - let i18n: { [index: string]: Object } = JSON.parse(fs.readFileSync(path.join(this.paths.i18nPath, "en_US.json"), "utf8")); - - if (language !== "en_US" && fs.existsSync(path.join(this.paths.i18nPath, `${language}.json`))) { - i18n = Object.assign(i18n, JSON.parse(fs.readFileSync(path.join(this.paths.i18nPath, `${language}.json`), "utf8"))); + let i18n: any = {} + if (!this.i18n[language]) { + i18n = this.i18n["en"][0].content; + } else { + i18n = this.i18n[language ?? "en"][0].content; } - /* else if (!fs.existsSync(path.join(this.paths.i18nPath, `${language}.json`))) { - fetch(`https://raw.githubusercontent.com/ciderapp/Cider/main/src/i18n/${language}.json`) - .then(res => res.json()) - .then(res => { - if (res) { - i18n = Object.assign(i18n, res); - fs.writeFileSync(path.join(this.paths.i18nPath, `${language}.json`), JSON.stringify(res)); - } else { - i18n = Object.assign(i18n, JSON.parse(fs.readFileSync(path.join(this.paths.i18nPath, `en_US.json`), "utf8"))); - } - }) - } */ if (key) { return i18n[key]; diff --git a/src/main/index.ts b/src/main/index.ts index abae1125..e345eb16 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -8,6 +8,7 @@ import { Plugins } from "./base/plugins"; import { BrowserWindow } from "./base/browserwindow"; import { init as Sentry } from "@sentry/electron"; import { RewriteFrames } from "@sentry/integrations"; +import { utils } from "./base/utils"; if (!app.isPackaged) { app.setPath("userData", join(app.getPath("appData"), "Cider")); @@ -30,8 +31,8 @@ const CiderPlug = new Plugins(); /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * App Event Handlers * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - -app.on("ready", () => { +app.on("ready", async () => { + await utils.initializeTranslations() Cider.ready(CiderPlug); console.log("[Cider] Application is Ready. Creating Window."); @@ -39,9 +40,10 @@ app.on("ready", () => { console.info("[Cider] Running in development mode."); require("vue-devtools").install(); } - + console.log("aa") components.whenReady().then(async () => { const bw = new BrowserWindow(); + console.log("[Cider] Creating Window.") const win = await bw.createWindow(); app.getGPUInfo("complete").then((gpuInfo) => { @@ -110,3 +112,4 @@ app.on("widevine-error", (error) => { console.log("[Cider][Widevine] Widevine installation encountered an error: " + error); app.exit(); }); + diff --git a/src/main/plugins/menubar.ts b/src/main/plugins/menubar.ts index dc652dec..3bd4588b 100644 --- a/src/main/plugins/menubar.ts +++ b/src/main/plugins/menubar.ts @@ -18,28 +18,45 @@ export default class Thumbar { private isNotMac: boolean = process.platform !== "darwin"; private isMac: boolean = process.platform === "darwin"; - private _menuTemplate: any = [ - { - label: app.getName(), - submenu: [ - { - label: `${utils.getLocale(utils.getStoreValue("general.language"), "term.about")} ${app.getName()}`, - click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('about')`), - }, - { type: "separator" }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.toggleprivate"), - accelerator: utils.getStoreValue("general.keybindings.togglePrivateSession").join("+"), - click: () => utils.getWindow().webContents.executeJavaScript(`app.cfg.general.privateEnabled = !app.cfg.general.privateEnabled`), - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.settings"), - accelerator: utils.getStoreValue("general.keybindings.settings").join("+"), - click: () => utils.getWindow().webContents.executeJavaScript(`app.openSettingsPage()`), - }, - ...(this.isMac ? [{ type: "separator" }, { role: "services" }, { type: "separator" }, { role: "hide" }, { role: "hideOthers" }, { role: "unhide" }, { type: "separator" }, { role: "quit" }] : []), - ...(this.isNotMac - ? [ + private _menuTemplate: any = [] + + /******************************************************************************************* + * Public Methods + * ****************************************************************************************/ + + /** + * Runs on plugin load (Currently run on application start) + */ + constructor(_utils: utils) { + console.debug(`[Plugin][${this.name}] Loading Complete.`); + } + + /** + * Runs on app ready + */ + onReady(_win: Electron.BrowserWindow): void { + this._menuTemplate = [ + { + label: app.getName(), + submenu: [ + { + label: `${utils.getLocale(utils.getStoreValue("general.language"), "term.about")} ${app.getName()}`, + click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('about')`), + }, + { type: "separator" }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.toggleprivate"), + accelerator: utils.getStoreValue("general.keybindings.togglePrivateSession").join("+"), + click: () => utils.getWindow().webContents.executeJavaScript(`app.cfg.general.privateEnabled = !app.cfg.general.privateEnabled`), + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.settings"), + accelerator: utils.getStoreValue("general.keybindings.settings").join("+"), + click: () => utils.getWindow().webContents.executeJavaScript(`app.openSettingsPage()`), + }, + ...(this.isMac ? [{ type: "separator" }, { role: "services" }, { type: "separator" }, { role: "hide" }, { role: "hideOthers" }, { role: "unhide" }, { type: "separator" }, { role: "quit" }] : []), + ...(this.isNotMac + ? [ { type: "separator" }, { label: utils.getLocale(utils.getStoreValue("general.language"), "term.quit"), @@ -47,62 +64,62 @@ export default class Thumbar { click: () => app.quit(), }, ] - : []), - ], - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.view"), - submenu: [ - ...(this.isMac ? [{ role: "reload" }, { role: "forceReload" }, { role: "toggleDevTools" }, { type: "separator" }, { role: "resetZoom" }, { role: "zoomIn" }, { role: "zoomOut" }, { type: "separator" }, { role: "togglefullscreen" }, { type: "separator" }] : []), - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.search"), - accelerator: utils.getStoreValue("general.keybindings.search").join("+"), - click: () => utils.getWindow().webContents.executeJavaScript("app.focusSearch()"), - }, - { type: "separator" }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.listenNow"), - accelerator: utils.getStoreValue("general.keybindings.listnow").join("+"), - click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('listen_now')`), - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.browse"), - accelerator: utils.getStoreValue("general.keybindings.browse").join("+"), - click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('browse')`), - }, - { type: "separator" }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.recentlyAdded"), - accelerator: utils.getStoreValue("general.keybindings.recentAdd").join("+"), - click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('library-recentlyadded')`), - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.songs"), - accelerator: utils.getStoreValue("general.keybindings.songs").join("+"), - click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('library-songs')`), - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.albums"), - accelerator: utils.getStoreValue("general.keybindings.albums").join("+"), - click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('library-albums')`), - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.artists"), - accelerator: utils.getStoreValue("general.keybindings.artists").join("+"), - click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('library-artists')`), - }, - ], - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.window"), - submenu: [ - { - role: "minimize", - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.minimize"), - }, - { type: "separator" }, - ...(this.isMac - ? [ + : []), + ], + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.view"), + submenu: [ + ...(this.isMac ? [{ role: "reload" }, { role: "forceReload" }, { role: "toggleDevTools" }, { type: "separator" }, { role: "resetZoom" }, { role: "zoomIn" }, { role: "zoomOut" }, { type: "separator" }, { role: "togglefullscreen" }, { type: "separator" }] : []), + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.search"), + accelerator: utils.getStoreValue("general.keybindings.search").join("+"), + click: () => utils.getWindow().webContents.executeJavaScript("app.focusSearch()"), + }, + { type: "separator" }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.listenNow"), + accelerator: utils.getStoreValue("general.keybindings.listnow").join("+"), + click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('listen_now')`), + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.browse"), + accelerator: utils.getStoreValue("general.keybindings.browse").join("+"), + click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('browse')`), + }, + { type: "separator" }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.recentlyAdded"), + accelerator: utils.getStoreValue("general.keybindings.recentAdd").join("+"), + click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('library-recentlyadded')`), + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.songs"), + accelerator: utils.getStoreValue("general.keybindings.songs").join("+"), + click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('library-songs')`), + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.albums"), + accelerator: utils.getStoreValue("general.keybindings.albums").join("+"), + click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('library-albums')`), + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.artists"), + accelerator: utils.getStoreValue("general.keybindings.artists").join("+"), + click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('library-artists')`), + }, + ], + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.window"), + submenu: [ + { + role: "minimize", + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.minimize"), + }, + { type: "separator" }, + ...(this.isMac + ? [ { label: "Show", click: () => utils.getWindow().show(), @@ -117,9 +134,9 @@ export default class Thumbar { }, { type: "separator" }, ] - : []), - ...(this.isNotMac - ? [ + : []), + ...(this.isNotMac + ? [ { label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.zoom"), submenu: [ @@ -164,142 +181,127 @@ export default class Thumbar { role: "forceReload", }, ] - : []), - ], - }, + : []), + ], + }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.controls"), - submenu: [ - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.playpause"), - accelerator: "Space", - click: () => utils.getWindow().webContents.executeJavaScript(`app.SpacePause()`), - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.next"), - accelerator: "CommandOrControl+Right", - click: () => utils.getWindow().webContents.executeJavaScript(`MusicKitInterop.next()`), - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.previous"), - accelerator: "CommandOrControl+Left", - click: () => utils.getWindow().webContents.executeJavaScript(`MusicKitInterop.previous()`), - }, - { type: "separator" }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.volumeup"), - accelerator: "CommandOrControl+Up", - click: () => utils.getWindow().webContents.executeJavaScript(`app.volumeUp()`), - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.volumedown"), - accelerator: "CommandOrControl+Down", - click: () => utils.getWindow().webContents.executeJavaScript(`app.volumeDown()`), - }, - { type: "separator" }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.cast2"), - accelerator: utils.getStoreValue("general.keybindings.castToDevices").join("+"), - click: () => utils.getWindow().webContents.executeJavaScript(`app.modals.castMenu = true`), - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.webremote"), - accelerator: utils.getStoreValue("general.keybindings.webRemote").join("+"), - sublabel: "Opens in external window", - click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('remote-pair')`), - }, - { type: "separator" }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.audioSettings"), - accelerator: utils.getStoreValue("general.keybindings.audioSettings").join("+"), - click: () => utils.getWindow().webContents.executeJavaScript(`app.modals.audioSettings = true`), - }, - { type: "separator" }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.plugins"), - accelerator: utils.getStoreValue("general.keybindings.pluginMenu").join("+"), - click: () => utils.getWindow().webContents.executeJavaScript(`app.modals.pluginMenu = true`), - }, - ], - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.account"), - submenu: [ - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.accountSettings"), - click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('apple-account-settings')`), - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.signout"), - click: () => utils.getWindow().webContents.executeJavaScript(`app.unauthorize()`), - }, - ], - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.support"), - role: "help", - submenu: [ - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.discord"), - click: () => shell.openExternal("https://discord.gg/AppleMusic").catch(console.error), - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "term.github"), - click: () => shell.openExternal("https://github.com/ciderapp/Cider/wiki/Troubleshooting").catch(console.error), - }, - { type: "separator" }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.report"), - submenu: [ - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.bug"), - click: () => shell.openExternal("https://github.com/ciderapp/Cider/issues/new?assignees=&labels=bug%2Ctriage&template=bug_report.yaml&title=%5BBug%5D%3A+").catch(console.error), - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.feature"), - click: () => shell.openExternal("https://github.com/ciderapp/Cider/discussions/new?category=feature-request").catch(console.error), - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.trans"), - click: () => shell.openExternal("https://github.com/ciderapp/Cider/issues/new?assignees=&labels=%F0%9F%8C%90+Translations&template=translation.yaml&title=%5BTranslation%5D%3A+").catch(console.error), - }, - ], - }, - { type: "separator" }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.license"), - click: () => shell.openExternal("https://github.com/ciderapp/Cider/blob/main/LICENSE").catch(console.error), - }, - { type: "separator" }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.toggledevtools"), - accelerator: utils.getStoreValue("general.keybindings.openDeveloperTools").join("+"), - click: () => utils.getWindow().webContents.openDevTools(), - }, - { - label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.conf"), - click: () => utils.getStoreInstance().openInEditor(), - }, - ], - }, - ]; + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.controls"), + submenu: [ + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.playpause"), + accelerator: "Space", + click: () => utils.getWindow().webContents.executeJavaScript(`app.SpacePause()`), + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.next"), + accelerator: "CommandOrControl+Right", + click: () => utils.getWindow().webContents.executeJavaScript(`MusicKitInterop.next()`), + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.previous"), + accelerator: "CommandOrControl+Left", + click: () => utils.getWindow().webContents.executeJavaScript(`MusicKitInterop.previous()`), + }, + { type: "separator" }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.volumeup"), + accelerator: "CommandOrControl+Up", + click: () => utils.getWindow().webContents.executeJavaScript(`app.volumeUp()`), + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.volumedown"), + accelerator: "CommandOrControl+Down", + click: () => utils.getWindow().webContents.executeJavaScript(`app.volumeDown()`), + }, + { type: "separator" }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.cast2"), + accelerator: utils.getStoreValue("general.keybindings.castToDevices").join("+"), + click: () => utils.getWindow().webContents.executeJavaScript(`app.modals.castMenu = true`), + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.webremote"), + accelerator: utils.getStoreValue("general.keybindings.webRemote").join("+"), + sublabel: "Opens in external window", + click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('remote-pair')`), + }, + { type: "separator" }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.audioSettings"), + accelerator: utils.getStoreValue("general.keybindings.audioSettings").join("+"), + click: () => utils.getWindow().webContents.executeJavaScript(`app.modals.audioSettings = true`), + }, + { type: "separator" }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.plugins"), + accelerator: utils.getStoreValue("general.keybindings.pluginMenu").join("+"), + click: () => utils.getWindow().webContents.executeJavaScript(`app.modals.pluginMenu = true`), + }, + ], + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.account"), + submenu: [ + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.accountSettings"), + click: () => utils.getWindow().webContents.executeJavaScript(`app.appRoute('apple-account-settings')`), + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.signout"), + click: () => utils.getWindow().webContents.executeJavaScript(`app.unauthorize()`), + }, + ], + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.support"), + role: "help", + submenu: [ + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.discord"), + click: () => shell.openExternal("https://discord.gg/AppleMusic").catch(console.error), + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "term.github"), + click: () => shell.openExternal("https://github.com/ciderapp/Cider/wiki/Troubleshooting").catch(console.error), + }, + { type: "separator" }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.report"), + submenu: [ + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.bug"), + click: () => shell.openExternal("https://github.com/ciderapp/Cider/issues/new?assignees=&labels=bug%2Ctriage&template=bug_report.yaml&title=%5BBug%5D%3A+").catch(console.error), + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.feature"), + click: () => shell.openExternal("https://github.com/ciderapp/Cider/discussions/new?category=feature-request").catch(console.error), + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.trans"), + click: () => shell.openExternal("https://github.com/ciderapp/Cider/issues/new?assignees=&labels=%F0%9F%8C%90+Translations&template=translation.yaml&title=%5BTranslation%5D%3A+").catch(console.error), + }, + ], + }, + { type: "separator" }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.license"), + click: () => shell.openExternal("https://github.com/ciderapp/Cider/blob/main/LICENSE").catch(console.error), + }, + { type: "separator" }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.toggledevtools"), + accelerator: utils.getStoreValue("general.keybindings.openDeveloperTools").join("+"), + click: () => utils.getWindow().webContents.openDevTools(), + }, + { + label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.conf"), + click: () => utils.getStoreInstance().openInEditor(), + }, + ], + }, + ]; - /******************************************************************************************* - * Public Methods - * ****************************************************************************************/ - - /** - * Runs on plugin load (Currently run on application start) - */ - constructor(_utils: utils) { - console.debug(`[Plugin][${this.name}] Loading Complete.`); - } - - /** - * Runs on app ready - */ - onReady(_win: Electron.BrowserWindow): void { const menu = Menu.buildFromTemplate(this._menuTemplate); Menu.setApplicationMenu(menu); } @@ -315,11 +317,11 @@ export default class Thumbar { * Runs on playback State Change * @param attributes Music Attributes (attributes.status = current state) */ - onPlaybackStateDidChange(attributes: object): void {} + onPlaybackStateDidChange(attributes: object): void { } /** * Runs on song change * @param attributes Music Attributes */ - onNowPlayingItemDidChange(attributes: object): void {} + onNowPlayingItemDidChange(attributes: object): void { } } diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index 0475ca88..8d5b41ab 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -19,7 +19,7 @@ const app = new Vue({ pluginInstalled: false, pluginMenuEntries: [], pluginMenuTopEntries: [], - lz: ipcRenderer.sendSync("get-i18n", "en_US"), + lz: ipcRenderer.sendSync("get-i18n", "en"), lzListing: ipcRenderer.sendSync("get-i18n-listing"), radiohls: null, search: { diff --git a/yarn.lock b/yarn.lock index 4958d573..b8f1b540 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1347,6 +1347,15 @@ __metadata: languageName: node linkType: hard +"@crowdin/ota-client@npm:^1.0.0": + version: 1.0.0 + resolution: "@crowdin/ota-client@npm:1.0.0" + dependencies: + axios: ^1 + checksum: b416632208cccf87235bd2ce7817c6b61c5069d626130f11e1034681ba9ff2ed6771f8b39e8a6afbde94f0274521cf1b2f5c02cc4dada31efe8881e5c9379952 + languageName: node + linkType: hard + "@develar/schema-utils@npm:~2.6.5": version: 2.6.5 resolution: "@develar/schema-utils@npm:2.6.5" @@ -3286,6 +3295,17 @@ __metadata: languageName: node linkType: hard +"axios@npm:^1": + version: 1.4.0 + resolution: "axios@npm:1.4.0" + dependencies: + follow-redirects: ^1.15.0 + form-data: ^4.0.0 + proxy-from-env: ^1.1.0 + checksum: 7fb6a4313bae7f45e89d62c70a800913c303df653f19eafec88e56cea2e3821066b8409bc68be1930ecca80e861c52aa787659df0ffec6ad4d451c7816b9386b + languageName: node + linkType: hard + "axlsign@git+https://github.com/ciderapp/curve25519-js.git": version: 1.0.0 resolution: "axlsign@https://github.com/ciderapp/curve25519-js.git#commit=cae68782564b83ffa1c7c757e40a3944cb140290" @@ -3999,6 +4019,7 @@ __metadata: resolution: "cider@workspace:." dependencies: "@achingbrain/ssdp": ^4.0.4 + "@crowdin/ota-client": ^1.0.0 "@sentry/electron": ^4.6.0 "@sentry/integrations": ^7.54.0 "@types/adm-zip": ^0.5.0 @@ -6062,7 +6083,7 @@ __metadata: languageName: node linkType: hard -"follow-redirects@npm:^1.0.0": +"follow-redirects@npm:^1.0.0, follow-redirects@npm:^1.15.0": version: 1.15.2 resolution: "follow-redirects@npm:1.15.2" peerDependenciesMeta: @@ -10080,6 +10101,13 @@ __metadata: languageName: node linkType: hard +"proxy-from-env@npm:^1.1.0": + version: 1.1.0 + resolution: "proxy-from-env@npm:1.1.0" + checksum: ed7fcc2ba0a33404958e34d95d18638249a68c430e30fcb6c478497d72739ba64ce9810a24f53a7d921d0c065e5b78e3822759800698167256b04659366ca4d4 + languageName: node + linkType: hard + "prr@npm:~1.0.1": version: 1.0.1 resolution: "prr@npm:1.0.1"