mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-05 09:00:11 +00:00
16 lines
462 B
TypeScript
16 lines
462 B
TypeScript
import { HomeAssistant } from "../types";
|
|
|
|
export const createLanguageListEl = (hass: HomeAssistant) => {
|
|
const list = document.createElement("datalist");
|
|
list.id = "languages";
|
|
for (const [language, metadata] of Object.entries(
|
|
hass.translationMetadata.translations
|
|
)) {
|
|
const option = document.createElement("option");
|
|
option.value = language;
|
|
option.innerText = metadata.nativeName;
|
|
list.appendChild(option);
|
|
}
|
|
return list;
|
|
};
|