Koha/koha-tmpl/intranet-tmpl/prog/js/vue/main-erm.ts
Jonathan Druart 556a3962b0
Bug 32030: ERM - I18N
Make the string translatable

To update the json files:
npx vue-i18n-extract --vueFiles 'koha-tmpl/intranet-tmpl/prog/js/vue/**/*.?(js|vue)' --exclude koha-tmpl/intranet-tmpl/prog/js/vue/dist/main.js --languageFiles 'koha-tmpl/intranet-tmpl/prog/js/vue/locales/*.json' --add --remove

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:55 -03:00

36 lines
1.2 KiB
TypeScript

import { createApp } from "vue";
import { createWebHistory, createRouter } from "vue-router";
import { createPinia } from "pinia";
import { library } from "@fortawesome/fontawesome-svg-core";
import { faPlus, faPencil, faTrash } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
library.add(faPlus, faPencil, faTrash);
import App from "./components/ERM/ERMMain.vue";
import { routes } from "./routes";
const router = createRouter({ history: createWebHistory(), routes });
import { useMainStore } from "./stores/main";
import { createI18n } from "vue-i18n";
import * as en from "./locales/en.json"; // We could async the load here, see https://vue-i18n.intlify.dev/guide/advanced/lazy.html
const languages = { en };
const messages = Object.assign(languages);
const i18n = createI18n({ locale: "en", messages });
createApp(App)
.use(createPinia())
.use(router)
.use(i18n)
.component("font-awesome-icon", FontAwesomeIcon)
.mount("#erm");
const mainStore = useMainStore();
const { removeMessages } = mainStore;
router.beforeEach((to, from) => {
removeMessages(); // This will actually flag the messages as displayed already
});