server: Initialize backend translations

This commit is contained in:
Elian Doran 2024-09-08 14:37:40 +03:00
parent c33154d128
commit c1010a79f9
No known key found for this signature in database
7 changed files with 26 additions and 2 deletions

10
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "trilium",
"version": "0.90.4",
"version": "0.90.6-beta",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "trilium",
"version": "0.90.4",
"version": "0.90.6-beta",
"license": "AGPL-3.0-only",
"dependencies": {
"@braintree/sanitize-url": "^7.1.0",
@ -48,6 +48,7 @@
"http-proxy-agent": "7.0.2",
"https-proxy-agent": "^7.0.5",
"i18next": "^23.14.0",
"i18next-fs-backend": "^2.3.2",
"i18next-http-backend": "^2.6.1",
"image-type": "4.1.0",
"ini": "^4.1.3",
@ -9660,6 +9661,11 @@
"@babel/runtime": "^7.23.2"
}
},
"node_modules/i18next-fs-backend": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/i18next-fs-backend/-/i18next-fs-backend-2.3.2.tgz",
"integrity": "sha512-LIwUlkqDZnUI8lnUxBnEj8K/FrHQTT/Sc+1rvDm9E8YvvY5YxzoEAASNx+W5M9DfD5s77lI5vSAFWeTp26B/3Q=="
},
"node_modules/i18next-http-backend": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/i18next-http-backend/-/i18next-http-backend-2.6.1.tgz",

View File

@ -88,6 +88,7 @@
"http-proxy-agent": "7.0.2",
"https-proxy-agent": "^7.0.5",
"i18next": "^23.14.0",
"i18next-fs-backend": "^2.3.2",
"i18next-http-backend": "^2.6.1",
"image-type": "4.1.0",
"ini": "^4.1.3",

View File

@ -12,6 +12,8 @@ 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,6 +59,17 @@ async function startTrilium() {
(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));
// for perf. issues it's good to know the rough configuration

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}