You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-12-14 23:26:58 +02:00
Detect locale
This commit is contained in:
@@ -85,6 +85,11 @@ class Setting extends BaseModel {
|
||||
this.scheduleUpdate();
|
||||
}
|
||||
|
||||
static formatValue(type, value) {
|
||||
if (type == 'int') return Math.floor(Number(value));
|
||||
return value;
|
||||
}
|
||||
|
||||
static value(key) {
|
||||
if (key in this.constants_) {
|
||||
let output = this.constants_[key];
|
||||
@@ -94,14 +99,15 @@ class Setting extends BaseModel {
|
||||
|
||||
if (!this.cache_) throw new Error('Settings have not been initialized!');
|
||||
|
||||
const md = this.settingMetadata(key);
|
||||
|
||||
for (let i = 0; i < this.cache_.length; i++) {
|
||||
if (this.cache_[i].key == key) {
|
||||
return this.cache_[i].value;
|
||||
return this.formatValue(md.type, this.cache_[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
let s = this.settingMetadata(key);
|
||||
return s.value;
|
||||
return this.formatValue(md.type, md.value);
|
||||
}
|
||||
|
||||
static isEnum(key) {
|
||||
@@ -184,6 +190,7 @@ class Setting extends BaseModel {
|
||||
delete s.appTypes;
|
||||
delete s.label;
|
||||
delete s.options;
|
||||
s.value = this.formatValue(s.type, s.value);
|
||||
queries.push(Database.insertQuery(this.tableName(), s));
|
||||
}
|
||||
|
||||
@@ -228,6 +235,7 @@ Setting.SYNC_TARGET_ONEDRIVE = 3;
|
||||
|
||||
Setting.metadata_ = {
|
||||
'activeFolderId': { value: '', type: 'string', public: false },
|
||||
'firstStart': { value: 1, type: 'int', public: false },
|
||||
'sync.2.path': { value: '', type: 'string', public: true, appTypes: ['cli'] },
|
||||
'sync.3.auth': { value: '', type: 'string', public: false },
|
||||
'sync.target': { value: Setting.SYNC_TARGET_ONEDRIVE, type: 'enum', public: true, label: () => _('Synchronisation target'), options: () => {
|
||||
|
||||
Reference in New Issue
Block a user