feat(mobx): implement locale options

This commit is contained in:
Paul
2021-12-11 11:56:33 +00:00
parent 89748d7044
commit 87a9841885
5 changed files with 155 additions and 144 deletions

View File

@@ -72,13 +72,21 @@ export default class LocaleOptions implements Persistent<Data> {
// eslint-disable-next-line require-jsdoc
@action hydrate(data: Data) {
this.lang = data.lang;
this.setLanguage(data.lang);
}
/**
* Get current language.
*/
@computed getLang() {
@computed getLanguage() {
return this.lang;
}
/**
* Set current language.
*/
@action setLanguage(language: Language) {
if (typeof Languages[language] === "undefined") return;
this.lang = language;
}
}