From 47c660460281932fb9c7622a62c2ff367958a57c Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Thu, 21 Apr 2022 20:42:12 +0800 Subject: [PATCH] chore: revert i18n handling, close #337 --- src/modules/i18n.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/i18n.ts b/src/modules/i18n.ts index 507223b..52b75dd 100644 --- a/src/modules/i18n.ts +++ b/src/modules/i18n.ts @@ -8,7 +8,10 @@ import { type UserModule } from '~/types' const messages = Object.fromEntries( Object.entries( import.meta.globEager('../../locales/*.y(a)?ml')) - .map(([key, value]) => [key.split('/').at(-1)?.replace(/\.ya?ml$/, ''), value.default]), + .map(([key, value]) => { + const yaml = key.endsWith('.yaml') + return [key.slice(14, yaml ? -5 : -4), value.default] + }), ) export const install: UserModule = ({ app }) => {