server: Set up early initialization of i18n

This commit is contained in:
Elian Doran
2024-09-08 15:05:18 +03:00
parent c1010a79f9
commit b45fde2e5f
5 changed files with 39 additions and 24 deletions

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env node
import app from "./app.js";
import sessionParser from "./routes/session_parser.js";
import fs from "fs";
@@ -12,8 +13,6 @@ import utils from "./services/utils.js";
import port from "./services/port.js";
import host from "./services/host.js";
import semver from "semver";
import i18next from "i18next";
import Backend from "i18next-fs-backend";
// setup basic error handling even before requiring dependencies, since those can produce errors as well
@@ -57,18 +56,7 @@ async function startTrilium() {
*/
if (utils.isElectron()) {
(await import('electron')).app.requestSingleInstanceLock();
}
// Initialize translations
i18next.use(Backend).init({
lng: "ro",
fallbackLng: "en",
ns: "server",
backend: {
loadPath: "translations/{{lng}}/{{ns}}.json"
},
debug: true
});
}
log.info(JSON.stringify(appInfo, null, 2));