Add core country and language settings (#14478)

This commit is contained in:
Bram Kragten
2022-11-29 20:54:18 +01:00
committed by GitHub
parent ee6f97b802
commit 92d022747b
14 changed files with 495 additions and 57 deletions

View File

@@ -158,13 +158,23 @@ export const currencies = [
"ZWL",
];
export const currencyDisplayNames =
Intl && "DisplayNames" in Intl
? new Intl.DisplayNames(undefined, {
type: "currency",
fallback: "code",
})
: undefined;
export const createCurrencyListEl = () => {
const list = document.createElement("datalist");
list.id = "currencies";
for (const currency of currencies) {
const option = document.createElement("option");
option.value = currency;
option.innerHTML = currency;
option.innerText = currencyDisplayNames
? currencyDisplayNames.of(currency)!
: currency;
list.appendChild(option);
}
return list;