Compare commits

...

2 commits

Author SHA1 Message Date
smartfridge
410c899c84
Translated using Weblate (Polish)
Currently translated at 100.0% (30 of 30 strings)

Translation: ArmCord/ArmCord
Translate-URL: https://hosted.weblate.org/projects/armcord/armcord/pl/
2022-06-12 00:15:32 +02:00
smartfrigde
fa24b7996f Add language detection from Discord 2022-06-11 22:14:33 +02:00
5 changed files with 39 additions and 14 deletions

View file

@ -7,7 +7,7 @@
"no": "Nie", "no": "Nie",
"next": "Dalej", "next": "Dalej",
"setup_question4": "Wybierz modyfikację klienta którą chcesz zainstalować:", "setup_question4": "Wybierz modyfikację klienta którą chcesz zainstalować:",
"setup_question4_clientmodnotice": "Dlaczego nie wszystkie na raz? Posiadanie wielu modyfikacji może spowodować wiele błędów. Jeśli jednak nalegasz możesz sprawdzić naszą dokumentację.", "setup_question4_clientmodnotice": "Dlaczego nie wszystkie na raz? Posiadanie wielu modyfikacji może spowodować wiele błędów. Jeśli jednak nalegasz możesz sprawdzić naszego Discorda.",
"loading_screen_start": "Ładowanie ArmCord…", "loading_screen_start": "Ładowanie ArmCord…",
"loading_screen_offline": "Wydaje nam się, że nie jesteś połączony z Internetem. Połącz się z internetem i spróbuj ponownie.", "loading_screen_offline": "Wydaje nam się, że nie jesteś połączony z Internetem. Połącz się z internetem i spróbuj ponownie.",
"setup_question1_answer1": "Ekspresowa konfiguracja", "setup_question1_answer1": "Ekspresowa konfiguracja",
@ -24,9 +24,9 @@
"settings-theme-default": "Domyślny", "settings-theme-default": "Domyślny",
"settings-theme-native": "Natywny", "settings-theme-native": "Natywny",
"settings-patches": "Automatyczne łatki", "settings-patches": "Automatyczne łatki",
"settings-invitewebsocket": "Wsparcie linków discord.gg", "settings-invitewebsocket": "Websocket dla zaproszeń",
"settings-prfmMode": "Performance mode:", "settings-prfmMode": "Tryb wydajności:",
"settings-prfmMode-performance": "Performance", "settings-prfmMode-performance": "Wydajny",
"settings-prfmMode-battery": "Battery", "settings-prfmMode-battery": "Bateria",
"settings-none": "None" "settings-none": "Nic/Brak"
} }

View file

@ -1,7 +1,7 @@
//ipc stuff //ipc stuff
import {app, ipcMain, shell, desktopCapturer} from "electron"; import {app, ipcMain, shell, desktopCapturer} from "electron";
import {createTabsGuest, mainWindow} from "./window"; import {createTabsGuest, mainWindow} from "./window";
import {setConfigBulk, getVersion, getConfig} from "./utils"; import {setConfigBulk, getVersion, getConfig, setLang} from "./utils";
import {customTitlebar, tabs} from "./main"; import {customTitlebar, tabs} from "./main";
import {createSettingsWindow} from "./settings/main"; import {createSettingsWindow} from "./settings/main";
export function registerIpc() { export function registerIpc() {
@ -11,6 +11,9 @@ export function registerIpc() {
ipcMain.on("openTab", (event, number: number) => { ipcMain.on("openTab", (event, number: number) => {
createTabsGuest(number); createTabsGuest(number);
}); });
ipcMain.on("setLang", (event, lang: string) => {
setLang(lang);
});
ipcMain.on("open-external-link", (event, href: string) => { ipcMain.on("open-external-link", (event, href: string) => {
shell.openExternal(href); shell.openExternal(href);
}); });

View file

@ -16,6 +16,7 @@ contextBridge.exposeInMainWorld("armcord", {
electron: process.versions.electron, electron: process.versions.electron,
channel: ipcRenderer.sendSync("channel"), channel: ipcRenderer.sendSync("channel"),
openTab: (number: number) => ipcRenderer.sendSync("openTab", number), openTab: (number: number) => ipcRenderer.sendSync("openTab", number),
setLang: (lang: string) => ipcRenderer.send("setLang", lang),
version: ipcRenderer.sendSync("get-app-version", "app-version"), version: ipcRenderer.sendSync("get-app-version", "app-version"),
getDisplayMediaSelector: getDisplayMediaSelector, getDisplayMediaSelector: getDisplayMediaSelector,
openSettingsWindow: () => ipcRenderer.send("openSettingsWindow") openSettingsWindow: () => ipcRenderer.send("openSettingsWindow")

View file

@ -4,11 +4,15 @@ import "./patch";
import * as fs from "fs"; import * as fs from "fs";
import * as path from "path"; import * as path from "path";
import {injectTitlebar} from "./titlebar"; import {injectTitlebar} from "./titlebar";
import {sleep, addStyle, injectJS} from "../utils"; import {sleep, addStyle, injectJS, addScript} from "../utils";
import {ipcRenderer} from "electron"; import {ipcRenderer} from "electron";
import {injectTabs} from "./tabs"; import {injectTabs} from "./tabs";
var version = ipcRenderer.sendSync("get-app-version", "app-version"); 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();`);
}
declare global { declare global {
interface Window { interface Window {
armcord: any; armcord: any;
@ -30,7 +34,7 @@ if (window.location.href.indexOf("splash.html") > -1) {
if (ipcRenderer.sendSync("tabs")) { if (ipcRenderer.sendSync("tabs")) {
injectTabs(); injectTabs();
} }
sleep(5000).then(() => { sleep(5000).then(async () => {
const cssPath = path.join(__dirname, "../", "/content/css/discord.css"); const cssPath = path.join(__dirname, "../", "/content/css/discord.css");
addStyle(fs.readFileSync(cssPath, "utf8")); addStyle(fs.readFileSync(cssPath, "utf8"));
@ -38,14 +42,17 @@ if (window.location.href.indexOf("splash.html") > -1) {
case "goosemod": case "goosemod":
injectJS(clientMods.goosemod); injectJS(clientMods.goosemod);
console.log("Loading GooseMod..."); console.log("Loading GooseMod...");
await updateLang();
break; break;
case "cumcord": case "cumcord":
injectJS(clientMods.cumcord); injectJS(clientMods.cumcord);
console.log("Loading Cumcord..."); console.log("Loading Cumcord...");
await updateLang();
break; break;
case "flicker": case "flicker":
injectJS(clientMods.flicker); injectJS(clientMods.flicker);
console.log("Loading FlickerMod..."); console.log("Loading FlickerMod...");
await updateLang();
break; break;
} }
}); });

View file

@ -1,7 +1,7 @@
import * as fs from "fs"; import * as fs from "fs";
import {app, dialog} from "electron"; import {app, dialog} from "electron";
import path from "path"; import path from "path";
import { defaultMaxListeners } from "events"; import {defaultMaxListeners} from "events";
export var firstRun: boolean; export var firstRun: boolean;
export var isSetup: boolean; export var isSetup: boolean;
export var contentPath: string; export var contentPath: string;
@ -88,8 +88,8 @@ export async function injectElectronFlags() {
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
const presets = { const presets = {
'performance': `--enable-gpu-rasterization --enable-zero-copy --ignore-gpu-blocklist --enable-hardware-overlays=single-fullscreen,single-on-top,underlay --enable-features=EnableDrDc,CanvasOopRasterization,BackForwardCache:TimeToLiveInBackForwardCacheInSeconds/300/should_ignore_blocklists/true/enable_same_site/true,ThrottleDisplayNoneAndVisibilityHiddenCrossOriginIframes,UseSkiaRenderer,WebAssemblyLazyCompilation --disable-features=Vulkan --force_high_performance_gpu`, // Performance performance: `--enable-gpu-rasterization --enable-zero-copy --ignore-gpu-blocklist --enable-hardware-overlays=single-fullscreen,single-on-top,underlay --enable-features=EnableDrDc,CanvasOopRasterization,BackForwardCache:TimeToLiveInBackForwardCacheInSeconds/300/should_ignore_blocklists/true/enable_same_site/true,ThrottleDisplayNoneAndVisibilityHiddenCrossOriginIframes,UseSkiaRenderer,WebAssemblyLazyCompilation --disable-features=Vulkan --force_high_performance_gpu`, // Performance
'battery': '--enable-features=TurnOffStreamingMediaCachingOnBattery --force_low_power_gpu' // Known to have better battery life for Chromium? battery: "--enable-features=TurnOffStreamingMediaCachingOnBattery --force_low_power_gpu" // Known to have better battery life for Chromium?
}; };
switch (await getConfig("performanceMode")) { switch (await getConfig("performanceMode")) {
case "performance": case "performance":
@ -104,6 +104,20 @@ export async function injectElectronFlags() {
console.log("No performance modes set"); console.log("No performance modes set");
} }
} }
export async function setLang(language: string) {
const userDataPath = app.getPath("userData");
const storagePath = path.join(userDataPath, "/storage/");
const langConfigFile = storagePath + "lang.json";
if (!fs.existsSync(langConfigFile)) {
fs.writeFileSync(langConfigFile, "{}", "utf-8");
}
let rawdata = fs.readFileSync(langConfigFile, "utf-8");
let parsed = JSON.parse(rawdata);
parsed["lang"] = language;
let toSave = JSON.stringify(parsed);
fs.writeFileSync(langConfigFile, toSave, "utf-8");
}
//ArmCord Settings/Storage manager //ArmCord Settings/Storage manager
export interface Settings { export interface Settings {
@ -113,7 +127,7 @@ export interface Settings {
minimizeToTray: boolean; minimizeToTray: boolean;
automaticPatches: boolean; automaticPatches: boolean;
mods: string; mods: string;
performanceMode: string, performanceMode: string;
blurType: string; blurType: string;
inviteWebsocket: boolean; inviteWebsocket: boolean;
doneSetup: boolean; doneSetup: boolean;