Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(desktop): window button alignment not corresponding OK if formatting locale is different
Elian Doran067383a87d36
diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.tsindex 52ebe458b0..a94709107f 100644--- a/apps/desktop/src/main.ts+++ b/apps/desktop/src/main.ts@@ -12,6 +12,7 @@ import { deferred } from "@triliumnext/server/src/services/utils.js";import { PRODUCT_NAME } from "./app-info";import port from "@triliumnext/server/src/services/port.js";import { join } from "path";+import { LOCALES } from "../../../packages/commons/src";async function main() {const userDataPath = getUserData();@@ -30,7 +31,7 @@ async function main() {// needed for excalidraw export https://github.com/zadam/trilium/issues/4271app.commandLine.appendSwitch("enable-experimental-web-platform-features");- app.commandLine.appendSwitch("lang", options.getOptionOrNull("formattingLocale") || options.getOptionOrNull("locale") || "en");+ app.commandLine.appendSwitch("lang", getElectronLocale());// Disable smooth scroll if the option is setconst smoothScrollEnabled = options.getOptionOrNull("smoothScrollEnabled");@@ -128,4 +129,15 @@ async function onReady() {await windowService.registerGlobalShortcuts();}+function getElectronLocale() {+ const uiLocale = options.getOptionOrNull("locale");+ const formattingLocale = options.getOptionOrNull("formattingLocale");+ const correspondingLocale = LOCALES.find(l => l.id === uiLocale);++ // For RTL, we have to force the UI locale to align the window buttons properly.+ if (formattingLocale && !correspondingLocale?.rtl) return formattingLocale;++ return uiLocale || "en"+}+main();