mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-10 17:13:38 +08:00
aeb5275648
Put dev/Storage/Settings.js in boots.js global rl.settings
38 lines
1 KiB
JavaScript
38 lines
1 KiB
JavaScript
import ko from 'ko';
|
|
|
|
class LanguageStore {
|
|
constructor() {
|
|
this.languages = ko.observableArray([]);
|
|
this.languagesAdmin = ko.observableArray([]);
|
|
|
|
this.language = ko
|
|
.observable('')
|
|
.extend({ limitedList: this.languages })
|
|
.extend({ reversible: true });
|
|
|
|
this.languageAdmin = ko
|
|
.observable('')
|
|
.extend({ limitedList: this.languagesAdmin })
|
|
.extend({ reversible: true });
|
|
|
|
this.userLanguage = ko.observable('');
|
|
this.userLanguageAdmin = ko.observable('');
|
|
}
|
|
|
|
populate() {
|
|
const Settings = rl.settings,
|
|
aLanguages = Settings.app('languages'),
|
|
aLanguagesAdmin = Settings.app('languagesAdmin');
|
|
|
|
this.languages(Array.isArray(aLanguages) ? aLanguages : []);
|
|
this.languagesAdmin(Array.isArray(aLanguagesAdmin) ? aLanguagesAdmin : []);
|
|
|
|
this.language(Settings.get('Language'));
|
|
this.languageAdmin(Settings.get('LanguageAdmin'));
|
|
|
|
this.userLanguage(Settings.get('UserLanguage'));
|
|
this.userLanguageAdmin(Settings.get('UserLanguageAdmin'));
|
|
}
|
|
}
|
|
|
|
export default new LanguageStore();
|