Fix wrong passing of locale values in Intl.DisplayNames
This commit is contained in:
parent
c31162220e
commit
b28fdcb0fa
1 changed files with 6 additions and 3 deletions
|
@ -29,12 +29,15 @@ function _localeCode2Text(code) {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (codeMappings[code]) {
|
if (codeMappings[code]) {
|
||||||
try {
|
try {
|
||||||
const text = IntlDN(locale || i18n.locale).of(codeMappings[code]);
|
const text = IntlDN(codeMappings[locale] || locale || i18n.locale).of(
|
||||||
|
codeMappings[code],
|
||||||
|
);
|
||||||
if (text !== codeMappings[code]) return text;
|
if (text !== codeMappings[code]) return text;
|
||||||
return fallback || '';
|
return fallback || '';
|
||||||
} catch (e) {}
|
} catch (e2) {
|
||||||
|
console.warn(code, e2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
console.warn(code, e);
|
|
||||||
return fallback || '';
|
return fallback || '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue