refactor: cleanup
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {Vue, Options} from 'vue-class-component';
|
import {Options, Vue} from 'vue-class-component';
|
||||||
import {setDocumentLocale} from '@/locale/locale';
|
|
||||||
import {Watch} from 'vue-property-decorator';
|
import {Watch} from 'vue-property-decorator';
|
||||||
|
|
||||||
@Options({name: 'DocumentLocaleSetter'})
|
@Options({name: 'DocumentLocaleSetter'})
|
||||||
@@ -11,7 +10,11 @@ export default class DocumentLocaleSetter extends Vue {
|
|||||||
|
|
||||||
@Watch('$i18n.locale')
|
@Watch('$i18n.locale')
|
||||||
onLocaleChanged(value: string): void {
|
onLocaleChanged(value: string): void {
|
||||||
setDocumentLocale(value);
|
this.setDocumentLocale(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
setDocumentLocale(locale: string): void {
|
||||||
|
document.documentElement.setAttribute('lang', locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -22,7 +22,3 @@ export function createI18n(): I18n {
|
|||||||
legacy: true,
|
legacy: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setDocumentLocale(locale: string): void {
|
|
||||||
document.documentElement.setAttribute("lang", locale);
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user