mapcomplete/UI/LanguagePicker.ts
Tobias d9040db12a Add label for language switcher
This is what I meant with " Optionally add translation for the lang-switcher-label". I added it inline since I dont know how the translation system works, yet. Feel free to revert this change; the label is not too importat IMO.
2021-01-20 22:24:00 +01:00

23 lines
No EOL
584 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("Change Language", languages.map(lang => {
return {value: lang, shown: lang}
}
), Locale.language, 'sr-only', 'bg-indigo-100 p-1 rounded hover:bg-indigo-200');
}
}