2024-07-20 09:32:56 +03:00
|
|
|
import library_loader from "./library_loader.js";
|
2024-08-11 08:12:01 +03:00
|
|
|
import options from "./options.js";
|
2024-07-20 09:32:56 +03:00
|
|
|
|
|
|
|
|
await library_loader.requireLibrary(library_loader.I18NEXT);
|
|
|
|
|
|
2024-08-11 08:12:01 +03:00
|
|
|
export async function initLocale() {
|
|
|
|
|
const locale = options.get("locale") || "en";
|
|
|
|
|
|
|
|
|
|
await i18next
|
|
|
|
|
.use(i18nextHttpBackend)
|
|
|
|
|
.init({
|
|
|
|
|
lng: locale,
|
|
|
|
|
fallbackLng: "en",
|
|
|
|
|
backend: {
|
2024-09-09 20:42:47 +03:00
|
|
|
loadPath: `${window.glob.assetPath}/translations/{{lng}}/{{ns}}.json`
|
2024-09-11 15:17:21 +08:00
|
|
|
},
|
|
|
|
|
returnEmptyString: false
|
2024-08-11 08:12:01 +03:00
|
|
|
});
|
|
|
|
|
}
|
2024-07-20 09:42:55 +03:00
|
|
|
|
2024-08-07 16:56:36 +08:00
|
|
|
export const t = i18next.t;
|