mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 03:15:54 +08:00
Remove invalid languages error (#9928)
Co-authored-by: crazywoola <427733928@qq.com>
This commit is contained in:
parent
af68084895
commit
aafa4a3c8b
@ -47,10 +47,8 @@ export const getLocaleOnServer = (): Locale => {
|
||||
}
|
||||
|
||||
// Validate languages
|
||||
if (!Array.isArray(languages) || languages.length === 0 || !languages.every(lang => typeof lang === 'string' && /^[\w-]+$/.test(lang))) {
|
||||
console.error(`Invalid languages: ${languages}`)
|
||||
if (!Array.isArray(languages) || languages.length === 0 || !languages.every(lang => typeof lang === 'string' && /^[\w-]+$/.test(lang)))
|
||||
languages = [i18n.defaultLocale]
|
||||
}
|
||||
|
||||
// match locale
|
||||
const matchedLocale = match(languages, locales, i18n.defaultLocale) as Locale
|
||||
|
Loading…
x
Reference in New Issue
Block a user