snappymail/dev/Stores/Language.js
djmaze 0b64083543 Array.isArray to isArray
Array.isNotEmpty to isNonEmptyArray
2021-03-16 16:49:14 +01:00

18 lines
540 B
JavaScript

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