1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-31 18:17:23 +01:00

chore: code clean up

This commit is contained in:
Amir Raminfar
2023-10-15 16:47:16 -07:00
parent 55775f651f
commit f47f60e51c

View File

@@ -2,15 +2,13 @@ import { type App } from "vue";
import { createI18n } from "vue-i18n";
const messages = Object.fromEntries(
Object.entries(import.meta.glob<{ default: any }>("../../locales/*.y(a)?ml", { eager: true })).map(([key, value]) => {
const yaml = key.endsWith(".yaml");
return [key.slice(14, yaml ? -5 : -4), value.default];
Object.entries(import.meta.glob<{ default: any }>("../../locales/*.yml", { eager: true })).map(([key, value]) => {
return [key.slice(14, -4), value.default];
}),
);
const userLang = navigator.language;
const shortLang = userLang.slice(0, 2);
const locale = messages.hasOwnProperty(userLang) ? userLang : shortLang;
const i18n = createI18n({