2020-08-17 17:23:15 +02:00
|
|
|
import {UIEventSource} from "../../Logic/UIEventSource";
|
2020-07-25 18:00:08 +02:00
|
|
|
import {UIElement} from "../UIElement";
|
2020-08-17 17:23:15 +02:00
|
|
|
import {LocalStorageSource} from "../../Logic/Web/LocalStorageSource";
|
2020-07-20 12:39:43 +02:00
|
|
|
|
|
|
|
|
|
|
|
export default class Locale {
|
2020-07-25 18:00:08 +02:00
|
|
|
|
2020-07-31 04:58:58 +02:00
|
|
|
public static language: UIEventSource<string> = Locale.setup();
|
2020-10-27 01:01:34 +01:00
|
|
|
|
2020-07-31 04:58:58 +02:00
|
|
|
private static setup() {
|
2020-07-31 17:11:44 +02:00
|
|
|
const source = LocalStorageSource.Get('language', "en");
|
|
|
|
if (!UIElement.runningFromConsole) {
|
|
|
|
// @ts-ignore
|
|
|
|
window.setLanguage = function (language: string) {
|
|
|
|
source.setData(language)
|
|
|
|
}
|
2020-07-31 04:58:58 +02:00
|
|
|
}
|
|
|
|
return source;
|
2020-07-25 18:00:08 +02:00
|
|
|
}
|
2020-07-20 12:39:43 +02:00
|
|
|
}
|
2020-07-25 18:00:08 +02:00
|
|
|
|
|
|
|
|