mapcomplete/UI/LanguagePicker.ts
2020-11-05 13:34:48 +01:00

23 lines
No EOL
512 B
TypeScript

import {UIElement} from "./UIElement";
import {DropDown} from "./Input/DropDown";
import Locale from "./i18n/Locale";
export default class LanguagePicker {
public static CreateLanguagePicker(
languages : string[] ,
label: string | UIElement = "") {
if (languages.length <= 1) {
return undefined;
}
return new DropDown(label, languages.map(lang => {
return {value: lang, shown: lang}
}
), Locale.language);
}
}