mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: i18n: fix language autodetect
This commit is contained in:
1 file changed
+2
-3
@@ -54,9 +54,8 @@ export class I18nService extends Service {
|
|||||||
// So if it doesn't exist, we should use the original text instead of fallback.
|
// 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();
|
return this.get(str, languages[0]) || this.get(str, 'en') || str.toString();
|
||||||
}
|
}
|
||||||
for (const language of languages.filter(Boolean)) {
|
for (const language of languages.filter(Boolean).map((i) => i.replace(/-/g, '_'))) {
|
||||||
const curr = this.get(str, language) || this.get(str, language.split('_')[0])
|
const curr = this.get(str, language) || this.get(str, language.split('_')[0]);
|
||||||
|| this.get(str, language.split('-')[0]);
|
|
||||||
if (curr) return curr;
|
if (curr) return curr;
|
||||||
}
|
}
|
||||||
return str.toString();
|
return str.toString();
|
||||||
|
|||||||
Reference in new issue
Block a user