Skip to content

Commit

Permalink
fix: synchronize locale with browser locale
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwep committed Jul 6, 2024
1 parent 1583d8b commit 2bf14af
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { watchEffect } from 'vue';
import { createI18n, IntlNumberFormat } from 'vue-i18n';
import de from './locales/de.json';
import en from './locales/en.json';
Expand Down Expand Up @@ -33,3 +34,8 @@ export const i18n = createI18n({
messages: messages as any,
numberFormats: Object.fromEntries(availableLocales.map((locale) => [locale, numberFormats]))
});

// Synchronize the i18n locale with the browser locale
watchEffect(() => {
document.documentElement.lang = i18n.global.locale.value;
});

0 comments on commit 2bf14af

Please sign in to comment.