2016-08-17 06:01:20 +08:00
|
|
|
import ko from 'ko';
|
2021-03-10 18:44:48 +08:00
|
|
|
import { Settings, SettingsGet } from 'Common/Globals';
|
2021-03-16 23:49:14 +08:00
|
|
|
import { isArray } from 'Common/Utils';
|
2015-01-27 05:06:00 +08:00
|
|
|
|
2021-01-27 17:59:15 +08:00
|
|
|
export const LanguageStore = {
|
2022-09-26 17:55:26 +08:00
|
|
|
language: ko.observable(''),
|
2021-01-27 17:59:15 +08:00
|
|
|
languages: ko.observableArray(),
|
|
|
|
userLanguage: ko.observable(''),
|
2022-12-12 20:03:41 +08:00
|
|
|
hourCycle: ko.observable(''),
|
2015-01-27 05:06:00 +08:00
|
|
|
|
2021-01-27 17:59:15 +08:00
|
|
|
populate: function() {
|
2021-03-10 18:44:48 +08:00
|
|
|
const aLanguages = Settings.app('languages');
|
2021-03-16 23:49:14 +08:00
|
|
|
this.languages(isArray(aLanguages) ? aLanguages : []);
|
2023-02-21 18:52:50 +08:00
|
|
|
this.language(SettingsGet('language'));
|
|
|
|
this.userLanguage(SettingsGet('userLanguage'));
|
2022-12-12 20:03:41 +08:00
|
|
|
this.hourCycle(SettingsGet('hourCycle'));
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
|
|
|
}
|