snappymail/dev/Stores/Language.js

19 lines
540 B
JavaScript
Raw Normal View History

import ko from 'ko';
2021-03-10 18:44:48 +08:00
import { Settings, SettingsGet } from 'Common/Globals';
import { isArray } from 'Common/Utils';
export const LanguageStore = {
languages: ko.observableArray(),
userLanguage: ko.observable(''),
populate: function() {
2021-03-10 18:44:48 +08:00
const aLanguages = Settings.app('languages');
this.languages(isArray(aLanguages) ? aLanguages : []);
2021-03-10 18:44:48 +08:00
this.language(SettingsGet('Language'));
this.userLanguage(SettingsGet('UserLanguage'));
}
}
LanguageStore.language = ko.observable('')
.extend({ limitedList: LanguageStore.languages });