core: i18n: fix language autodetect

This commit is contained in:
undefined committed 2025-12-24 02:31:59 +08:00
1 parent 2596f9db9b
commit e787b8e7cc
1 file changed
+2 -3
+2 -3
View File
@@ -54,9 +54,8 @@ export class I18nService extends Service {
// So if it doesn't exist, we should use the original text instead of fallback.
return this.get(str, languages[0]) || this.get(str, 'en') || str.toString();
}
for (const language of languages.filter(Boolean)) {
const curr = this.get(str, language) || this.get(str, language.split('_')[0])
|| this.get(str, language.split('-')[0]);
for (const language of languages.filter(Boolean).map((i) => i.replace(/-/g, '_'))) {
const curr = this.get(str, language) || this.get(str, language.split('_')[0]);
if (curr) return curr;
}
return str.toString();