mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-07-16 09:38:51 +02:00
fix:#5 readded missing locale function for dom
This commit is contained in:
@ -20,6 +20,18 @@ function setup() {
|
||||
return _i18n;
|
||||
}
|
||||
|
||||
// Sets the active locale.
|
||||
function setLocale(newLocale: any) {
|
||||
_i18n.global.locale = newLocale;
|
||||
setDocumentAttributesFor(newLocale);
|
||||
}
|
||||
|
||||
function setDocumentAttributesFor(locale: any) {
|
||||
const htmlElement = document.querySelector("html");
|
||||
|
||||
htmlElement?.setAttribute("lang", locale);
|
||||
}
|
||||
|
||||
// Public interface
|
||||
export default {
|
||||
// Expose the VueI18n instance via a getter
|
||||
@ -27,4 +39,5 @@ export default {
|
||||
return _i18n;
|
||||
},
|
||||
setup,
|
||||
setLocale,
|
||||
};
|
||||
|
Reference in New Issue
Block a user