2015-01-27 05:06:00 +08:00
|
|
|
|
|
|
|
(function () {
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var
|
|
|
|
ko = require('ko'),
|
|
|
|
|
|
|
|
Utils = require('Common/Utils'),
|
|
|
|
|
|
|
|
Settings = require('Storage/Settings')
|
|
|
|
;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
function LanguageStore()
|
|
|
|
{
|
|
|
|
this.languages = ko.observableArray([]);
|
2015-03-28 06:06:56 +08:00
|
|
|
this.languagesAdmin = ko.observableArray([]);
|
2015-01-27 05:06:00 +08:00
|
|
|
|
|
|
|
this.language = ko.observable('')
|
|
|
|
.extend({'limitedList': this.languages});
|
2015-03-28 06:06:56 +08:00
|
|
|
|
|
|
|
this.languageAdmin = ko.observable('')
|
|
|
|
.extend({'limitedList': this.languagesAdmin});
|
|
|
|
|
2015-04-17 21:56:29 +08:00
|
|
|
this.userLanguage = ko.observable('');
|
|
|
|
this.userLanguageAdmin = ko.observable('');
|
2015-01-27 05:06:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
LanguageStore.prototype.populate = function ()
|
|
|
|
{
|
2015-03-16 21:54:56 +08:00
|
|
|
var
|
|
|
|
aLanguages = Settings.settingsGet('Languages'),
|
2015-03-28 06:06:56 +08:00
|
|
|
aLanguagesAdmin = Settings.settingsGet('LanguagesAdmin')
|
2015-03-16 21:54:56 +08:00
|
|
|
;
|
2015-01-27 05:06:00 +08:00
|
|
|
|
|
|
|
this.languages(Utils.isArray(aLanguages) ? aLanguages : []);
|
2015-03-28 06:06:56 +08:00
|
|
|
this.languagesAdmin(Utils.isArray(aLanguagesAdmin) ? aLanguagesAdmin : []);
|
2015-03-16 21:54:56 +08:00
|
|
|
|
2015-01-27 05:06:00 +08:00
|
|
|
this.language(Settings.settingsGet('Language'));
|
2015-03-28 06:06:56 +08:00
|
|
|
this.languageAdmin(Settings.settingsGet('LanguageAdmin'));
|
|
|
|
|
|
|
|
this.userLanguage(Settings.settingsGet('UserLanguage'));
|
|
|
|
this.userLanguageAdmin(Settings.settingsGet('UserLanguageAdmin'));
|
2015-01-27 05:06:00 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = new LanguageStore();
|
|
|
|
|
|
|
|
}());
|