try to use the browser's default language as out default language

This commit is contained in:
wea_ondara
2023-09-28 19:17:58 +02:00
parent 6cf5a7d84c
commit c246a06f7a
+8 -1
View File
@@ -14,8 +14,15 @@ const datetimeFormats = {
};
export function createI18n(): I18n {
let browserLocale = (navigator.language ?? '').toLowerCase();
const match = browserLocale.match(/^([a-z][a-z])/);
if (match) {
browserLocale = match[1];
} else {
browserLocale = 'en';
}
return vueCreateI18n({
locale: 'de',
locale: browserLocale,
fallbackLocale: 'en',
messages: messages,
datetimeFormats: datetimeFormats,