mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
server: Implement basic restore of language
This commit is contained in:
parent
68042994e0
commit
317b7b4c59
@ -1,10 +1,11 @@
|
||||
import i18next from "i18next";
|
||||
import Backend from "i18next-fs-backend";
|
||||
import options from "./options.js";
|
||||
|
||||
export async function initializeTranslations() {
|
||||
// Initialize translations
|
||||
await i18next.use(Backend).init({
|
||||
lng: "ro",
|
||||
lng: await getCurrentLanguage(),
|
||||
fallbackLng: "en",
|
||||
ns: "server",
|
||||
backend: {
|
||||
@ -13,3 +14,15 @@ export async function initializeTranslations() {
|
||||
debug: true
|
||||
});
|
||||
}
|
||||
|
||||
function getCurrentLanguage() {
|
||||
let language;
|
||||
language = options.getOption("locale");
|
||||
|
||||
if (!language) {
|
||||
console.info("Language option not found, falling back to en.");
|
||||
language = "en";
|
||||
}
|
||||
|
||||
return language;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user