mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-05 13:57:10 -04:00
feat(i18n): Set the page language according to the browser default language
This commit is contained in:
parent
7d9790ad5a
commit
2999b9b50a
1 changed files with 3 additions and 1 deletions
|
@ -3,9 +3,11 @@ import { get } from '@vueuse/core';
|
||||||
import type { Plugin } from 'vue';
|
import type { Plugin } from 'vue';
|
||||||
import { createI18n } from 'vue-i18n';
|
import { createI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
const localeLang = navigator.language || navigator.languages[0] || 'en';
|
||||||
|
|
||||||
const i18n = createI18n({
|
const i18n = createI18n({
|
||||||
legacy: false,
|
legacy: false,
|
||||||
locale: 'en',
|
locale: localeLang.split('-')[0],
|
||||||
fallbackLocale: 'en',
|
fallbackLocale: 'en',
|
||||||
messages,
|
messages,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue