mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-04 05:52:44 +08:00
36 lines
998 B
JavaScript
36 lines
998 B
JavaScript
import ko from 'ko';
|
|
|
|
class LanguageStore {
|
|
constructor() {
|
|
this.languages = ko.observableArray([]);
|
|
this.languagesAdmin = ko.observableArray([]);
|
|
|
|
this.language = ko
|
|
.observable('')
|
|
.extend({ limitedList: this.languages, reversible: true });
|
|
|
|
this.languageAdmin = ko
|
|
.observable('')
|
|
.extend({ limitedList: this.languagesAdmin, 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();
|