From f47f60e51c975c1b8f88f9c1053bc75e8e4bc0d4 Mon Sep 17 00:00:00 2001 From: Amir Raminfar Date: Sun, 15 Oct 2023 16:47:16 -0700 Subject: [PATCH] chore: code clean up --- assets/modules/i18n.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/assets/modules/i18n.ts b/assets/modules/i18n.ts index f57f9d08..ee2961cf 100644 --- a/assets/modules/i18n.ts +++ b/assets/modules/i18n.ts @@ -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({