diff --git a/src/langs/router.ts b/src/langs/router.ts index b255792..0e3ed2c 100644 --- a/src/langs/router.ts +++ b/src/langs/router.ts @@ -14,6 +14,7 @@ export const LangRouter = (userLocale: string, defaultLang: string, langs: Parti function getValue(locale?: string) { if (typeof locale === 'undefined') throw new Error('Undefined locale'); let value = langs[locale] as Record; + if (typeof value === 'undefined') throw new Error(`Locale "${locale}" not found`); for (const i of route) value = value[i]; return value; } @@ -51,4 +52,4 @@ export type __InternalParseLocale> = { }; export type ParseLocales> = T; -/**Idea inspiration from: FreeAoi */ +/**Idea inspiration from: FreeAoi | Fixed by: Drylozu */