Files
Trilium/src/public/app/services/i18n.ts

20 lines
530 B
TypeScript
Raw Normal View History

import library_loader from "./library_loader.js";
2024-08-11 08:12:01 +03:00
import options from "./options.js";
await library_loader.requireLibrary(library_loader.I18NEXT);
2024-08-11 08:12:01 +03:00
export async function initLocale() {
2024-12-19 20:52:43 +02:00
const locale = (options.get("locale") as string) || "en";
2024-08-11 08:12:01 +03:00
2025-01-09 18:07:02 +02:00
await i18next.use(i18nextHttpBackend).init({
lng: locale,
fallbackLng: "en",
backend: {
loadPath: `${window.glob.assetPath}/translations/{{lng}}/{{ns}}.json`
},
returnEmptyString: false
});
2024-08-11 08:12:01 +03:00
}
2024-07-20 09:42:55 +03:00
export const t = i18next.t;