mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
Add setup translation loading
This commit is contained in:
parent
994ab5f5b0
commit
86c3636a19
6 changed files with 49 additions and 12 deletions
|
@ -34,6 +34,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"electron-context-menu": "github:ArmCord/electron-context-menu",
|
||||
"os-locale": "^6.0.2",
|
||||
"v8-compile-cache": "^2.3.0",
|
||||
"ws": "^8.6.0"
|
||||
},
|
||||
|
|
|
@ -12,12 +12,14 @@
|
|||
<body>
|
||||
<div class="container">
|
||||
<div id="warning" class="hidden">
|
||||
<p>You appear to be offline. Please connect to the internet and restart ArmCord Setup.</p>
|
||||
<p id="setup_offline">
|
||||
You appear to be offline. Please connect to the internet and restart ArmCord Setup.
|
||||
</p>
|
||||
</div>
|
||||
<div id="setup">
|
||||
<div id="logo" class="hidden"></div>
|
||||
<div id="page1" class="hidden">
|
||||
<p>Select the type of setup you want to perform.</p>
|
||||
<p id="setup_question1">Select the type of setup you want to perform.</p>
|
||||
<div id="buttons">
|
||||
<button id="express" class="center">Express</button>
|
||||
<button id="full" class="center">Full</button>
|
||||
|
@ -25,7 +27,7 @@
|
|||
</div>
|
||||
|
||||
<div id="page2" class="hidden">
|
||||
<p class="text-center setup-ask">Choose your Discord channel/instance:</p>
|
||||
<p class="text-center setup-ask" id="setup_question2">Choose your Discord channel/instance:</p>
|
||||
<div class="center">
|
||||
<select name="channel" id="channel" class="dropdown-button">
|
||||
<option value="stable">Stable</option>
|
||||
|
@ -34,7 +36,9 @@
|
|||
<option value="foss">Fosscord</option>
|
||||
</select>
|
||||
</div>
|
||||
<p class="text-center setup-ask">Should ArmCord handle client mods installation?</p>
|
||||
<p class="text-center setup-ask" id="setup_question3">
|
||||
Should ArmCord handle client mods installation?
|
||||
</p>
|
||||
<div class="center">
|
||||
<select name="csp" id="csp" class="dropdown-button">
|
||||
<option value="true">Yes</option>
|
||||
|
@ -47,7 +51,7 @@
|
|||
</div>
|
||||
|
||||
<div id="page3" class="hidden">
|
||||
<p class="text-center setup-ask">Select a client mod you want to install:</p>
|
||||
<p class="text-center setup-ask" id="setup_question4">Select a client mod you want to install:</p>
|
||||
<div class="center">
|
||||
<select name="mod" id="mod" class="dropdown-button">
|
||||
<option value="cumcord">Cumcord</option>
|
||||
|
@ -55,7 +59,7 @@
|
|||
<option value="flicker">Flicker (Heavily WIP)</option>
|
||||
</select>
|
||||
</div>
|
||||
<p class="text-center">
|
||||
<p class="text-center" id="setup_question4_clientmodnotice">
|
||||
Why not all of them? Having many client mods at the same time can cause issues. If you really
|
||||
want to do it though, check our Discord ;)
|
||||
</p>
|
||||
|
@ -65,7 +69,25 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
async function loadLang() {
|
||||
document.getElementById("next").innerHTML = await armcord.getLang("next");
|
||||
document.getElementById("setup_offline").innerHTML = await armcord.getLang("setup_offline");
|
||||
document.getElementById("setup_question1").innerHTML = await armcord.getLang("setup_question1");
|
||||
document.getElementById("express").innerHTML = await armcord.getLang("setup_question1_answer1");
|
||||
document.getElementById("full").innerHTML = await armcord.getLang("setup_question1_answer2");
|
||||
document.getElementById("setup_question2").innerHTML = await armcord.getLang("setup_question2");
|
||||
document.getElementById("setup_question3").innerHTML = await armcord.getLang("setup_question3");
|
||||
document.getElementById("setup_question4").innerHTML = await armcord.getLang("setup_question4");
|
||||
document.getElementById("setup_question4_clientmodnotice").innerHTML = await armcord.getLang(
|
||||
"setup_question4_clientmodnotice"
|
||||
);
|
||||
//select stuff1
|
||||
document.getElementById("csp").options[1].text = await armcord.getLang("no");
|
||||
document.getElementById("csp").options[0].text = await armcord.getLang("yes");
|
||||
}
|
||||
loadLang();
|
||||
</script>
|
||||
<script>
|
||||
document.onload = function () {
|
||||
ipcRenderer.send("win-unmaximize");
|
||||
|
|
|
@ -60,6 +60,9 @@ export function registerIpc() {
|
|||
ipcMain.on("channel", async (event) => {
|
||||
event.returnValue = await getConfig("channel");
|
||||
});
|
||||
ipcMain.handle("getLang", (event, toGet: string) => {
|
||||
return getLang(toGet);
|
||||
});
|
||||
ipcMain.on("clientmod", async (event, arg) => {
|
||||
event.returnValue = await getConfig("mods");
|
||||
});
|
||||
|
|
|
@ -17,6 +17,10 @@ contextBridge.exposeInMainWorld("armcord", {
|
|||
channel: ipcRenderer.sendSync("channel"),
|
||||
openTab: (number: number) => ipcRenderer.sendSync("openTab", number),
|
||||
setLang: (lang: string) => ipcRenderer.send("setLang", lang),
|
||||
getLang: (toGet: string) =>
|
||||
ipcRenderer.invoke("getLang", toGet).then((result) => {
|
||||
return result;
|
||||
}),
|
||||
version: ipcRenderer.sendSync("get-app-version", "app-version"),
|
||||
getDisplayMediaSelector: getDisplayMediaSelector,
|
||||
openSettingsWindow: () => ipcRenderer.send("openSettingsWindow")
|
||||
|
|
|
@ -9,9 +9,13 @@ import {ipcRenderer} from "electron";
|
|||
import {injectTabs} from "./tabs";
|
||||
var version = ipcRenderer.sendSync("get-app-version", "app-version");
|
||||
async function updateLang() {
|
||||
addScript(`function getDiscordLang() {
|
||||
{const _w=webpackChunkdiscord_app;let lang;_w.push([[Symbol()],{},e=>{for(const k in e.c){const m=e.c[k].exports;const mDef=m?.default&&m.__esModule?m.default:m;if(mDef?._chosenLocale&&!lang)lang=mDef}}]);_w.pop();window.armcord.setLang(lang._chosenLocale);return lang._chosenLocale;void 0}}
|
||||
getDiscordLang();`);
|
||||
if (window.location.href.indexOf("setup.html") > -1) {
|
||||
console.log("Setup, skipping lang update");
|
||||
} else {
|
||||
addScript(`function getDiscordLang() {
|
||||
{const _w=webpackChunkdiscord_app;let lang;_w.push([[Symbol()],{},e=>{for(const k in e.c){const m=e.c[k].exports;const mDef=m?.default&&m.__esModule?m.default:m;if(mDef?._chosenLocale&&!lang)lang=mDef}}]);_w.pop();window.armcord.setLang(lang._chosenLocale);return lang._chosenLocale;void 0}}
|
||||
getDiscordLang();`);
|
||||
}
|
||||
}
|
||||
declare global {
|
||||
interface Window {
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
// I'm sorry for this mess but I'm not sure how to fix it.
|
||||
import {BrowserWindow, shell, app, ipcMain, dialog, clipboard} from "electron";
|
||||
import path from "path";
|
||||
import {checkIfConfigIsBroken, firstRun, getConfig, contentPath, isSetup, setConfig} from "./utils";
|
||||
import {checkIfConfigIsBroken, firstRun, getConfig, contentPath, isSetup, setConfig, setLang} from "./utils";
|
||||
import {registerIpc} from "./ipc";
|
||||
import startServer from "./socket";
|
||||
import {osLocale} from 'os-locale';
|
||||
import contextMenu from "electron-context-menu";
|
||||
import os from "os";
|
||||
export var icon: string;
|
||||
|
@ -85,10 +86,10 @@ async function doAfterDefiningTheWindow() {
|
|||
if ((await getConfig("inviteWebsocket")) == true) {
|
||||
startServer();
|
||||
}
|
||||
|
||||
try {
|
||||
mainWindow.loadFile(contentPath);
|
||||
if (isSetup) {
|
||||
await setLang(Intl.DateTimeFormat().resolvedOptions().locale)
|
||||
mainWindow.setSize(390, 470);
|
||||
}
|
||||
} catch (e) {
|
||||
|
@ -98,6 +99,7 @@ async function doAfterDefiningTheWindow() {
|
|||
console.log(process.platform);
|
||||
if (process.platform === "win32") {
|
||||
if (firstRun) {
|
||||
// await setLang(Intl.DateTimeFormat().resolvedOptions().locale)
|
||||
mainWindow.setSize(390, 470);
|
||||
mainWindow.loadURL(`file://${__dirname}/content/setup.html`);
|
||||
} else {
|
||||
|
@ -105,6 +107,7 @@ async function doAfterDefiningTheWindow() {
|
|||
}
|
||||
} else {
|
||||
if (firstRun) {
|
||||
await setLang(Intl.DateTimeFormat().resolvedOptions().locale)
|
||||
mainWindow.setSize(390, 470);
|
||||
mainWindow.loadURL(`file://${__dirname}/ts-out/content/setup.html`);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue