fix(desktop): window button alignment not corresponding OK if formatting locale is different

This commit is contained in:
Elian Doran 2025-10-14 15:04:07 +03:00
parent 7e871c3b04
commit 067383a87d
No known key found for this signature in database

View File

@ -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/4271
app.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 set
const 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();