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

19 lines
504 B
TypeScript
Raw Normal View History

2024-08-11 08:12:01 +03:00
import options from "./options.js";
2025-02-28 08:26:48 +01:00
import i18next from "i18next";
import i18nextHttpBackend from "i18next-http-backend";
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;