mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2026-01-18 12:32:26 +01:00
feat:#60 format, lint and fix build
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import { createI18n } from "vue-i18n";
|
||||
import en from './translations/en.json'
|
||||
import de from './translations/de.json'
|
||||
import en from "./translations/en.json";
|
||||
import de from "./translations/de.json";
|
||||
import localeStore from "../store/localeStore.ts";
|
||||
|
||||
export const supportedLocales= {
|
||||
'en': { name: 'English'},
|
||||
'de': { name: 'Deutsch'},
|
||||
}
|
||||
export const supportedLocales = {
|
||||
en: { name: "English" },
|
||||
de: { name: "Deutsch" },
|
||||
};
|
||||
// Private instance of VueI18n object
|
||||
let _i18n: any
|
||||
let _i18n: any;
|
||||
// Initializer
|
||||
function setup() {
|
||||
_i18n = createI18n({
|
||||
@@ -17,30 +17,30 @@ function setup() {
|
||||
fallbackLocale: "en",
|
||||
messages: {
|
||||
en,
|
||||
de
|
||||
de,
|
||||
},
|
||||
})
|
||||
return _i18n
|
||||
});
|
||||
return _i18n;
|
||||
}
|
||||
|
||||
// Sets the active locale.
|
||||
function setLocale(newLocale : any) {
|
||||
_i18n.global.locale = newLocale
|
||||
setDocumentAttributesFor(newLocale)
|
||||
function setLocale(newLocale: any) {
|
||||
_i18n.global.locale = newLocale;
|
||||
setDocumentAttributesFor(newLocale);
|
||||
}
|
||||
|
||||
function setDocumentAttributesFor(locale: any) {
|
||||
const htmlElement = document.querySelector('html')
|
||||
const htmlElement = document.querySelector("html");
|
||||
|
||||
htmlElement?.setAttribute('lang', locale)
|
||||
htmlElement?.setAttribute("lang", locale);
|
||||
}
|
||||
|
||||
// Public interface
|
||||
export default {
|
||||
// Expose the VueI18n instance via a getter
|
||||
get vueI18n() {
|
||||
return _i18n
|
||||
return _i18n;
|
||||
},
|
||||
setup,
|
||||
setLocale,
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user