2020-07-20 22:07:04 +00:00
|
|
|
import {UIEventSource} from "../UIEventSource";
|
2020-07-24 15:53:09 +00:00
|
|
|
import {LocalStorageSource} from "../../Logic/LocalStorageSource";
|
2020-07-25 16:00:08 +00:00
|
|
|
import {DropDown} from "../Input/DropDown";
|
|
|
|
import {Layout} from "../../Customizations/Layout";
|
|
|
|
import {UIElement} from "../UIElement";
|
2020-07-20 10:39:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
export default class Locale {
|
2020-07-24 15:53:09 +00:00
|
|
|
public static language: UIEventSource<string> = LocalStorageSource.Get('language', "en");
|
2020-07-25 16:00:08 +00:00
|
|
|
|
|
|
|
public static CreateLanguagePicker(layoutToUse: Layout, label: string | UIElement = "") {
|
|
|
|
|
|
|
|
return new DropDown(label, layoutToUse.supportedLanguages.map(lang => {
|
|
|
|
return {value: lang, shown: lang}
|
|
|
|
}
|
|
|
|
), Locale.language);
|
|
|
|
}
|
2020-07-20 10:39:43 +00:00
|
|
|
}
|
2020-07-25 16:00:08 +00:00
|
|
|
|
|
|
|
|