mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-15 20:24:51 +08:00
ea48f5060b
isUnd(*) to native undefined === * isFunc to native typeof * === 'function' isObject to native typeof * === 'object' microtime() to native Date().getTime(); noop to native ()=>{} noopFalse to native ()=>false noopTrue to native ()=>true boolToAjax to native *?'1':'0' Underscore.js to native
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
import ko from 'ko';
|
|
import * as Settings from 'Storage/Settings';
|
|
|
|
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 aLanguages = Settings.appSettingsGet('languages'),
|
|
aLanguagesAdmin = Settings.appSettingsGet('languagesAdmin');
|
|
|
|
this.languages(Array.isArray(aLanguages) ? aLanguages : []);
|
|
this.languagesAdmin(Array.isArray(aLanguagesAdmin) ? aLanguagesAdmin : []);
|
|
|
|
this.language(Settings.settingsGet('Language'));
|
|
this.languageAdmin(Settings.settingsGet('LanguageAdmin'));
|
|
|
|
this.userLanguage(Settings.settingsGet('UserLanguage'));
|
|
this.userLanguageAdmin(Settings.settingsGet('UserLanguageAdmin'));
|
|
}
|
|
}
|
|
|
|
export default new LanguageStore();
|