2020-07-21 00:07:04 +02:00
|
|
|
import {UIEventSource} from "../UIEventSource";
|
2020-07-24 17:53:09 +02:00
|
|
|
import {LocalStorageSource} from "../../Logic/LocalStorageSource";
|
2020-07-25 18:00:08 +02:00
|
|
|
import {DropDown} from "../Input/DropDown";
|
|
|
|
import {Layout} from "../../Customizations/Layout";
|
|
|
|
import {UIElement} from "../UIElement";
|
2020-07-31 01:45:54 +02:00
|
|
|
import {State} from "../../State";
|
2020-07-20 12:39:43 +02:00
|
|
|
|
|
|
|
|
|
|
|
export default class Locale {
|
2020-07-24 17:53:09 +02:00
|
|
|
public static language: UIEventSource<string> = LocalStorageSource.Get('language', "en");
|
2020-07-25 18:00:08 +02:00
|
|
|
|
2020-07-31 01:45:54 +02:00
|
|
|
public static CreateLanguagePicker(label: string | UIElement = "") {
|
2020-07-25 18:00:08 +02:00
|
|
|
|
2020-07-31 01:45:54 +02:00
|
|
|
return new DropDown(label, State.state.layoutToUse.data.supportedLanguages.map(lang => {
|
2020-07-25 18:00:08 +02:00
|
|
|
return {value: lang, shown: lang}
|
|
|
|
}
|
|
|
|
), Locale.language);
|
|
|
|
}
|
2020-07-20 12:39:43 +02:00
|
|
|
}
|
2020-07-25 18:00:08 +02:00
|
|
|
|
|
|
|
|