Files
htwkalender/frontend/src/i18n/index.ts
2024-01-31 15:46:31 +01:00

31 lines
630 B
TypeScript

import { createI18n } from "vue-i18n";
import en from "./translations/en.json";
import de from "./translations/de.json";
import localeStore from "../store/localeStore.ts";
// Private instance of VueI18n object
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let _i18n: any;
// Initializer
function setup() {
_i18n = createI18n({
legacy: false,
locale: localeStore().locale,
fallbackLocale: "en",
messages: {
en,
de,
},
});
return _i18n;
}
// Public interface
export default {
// Expose the VueI18n instance via a getter
get vueI18n() {
return _i18n;
},
setup,
};