Skip to content

Commit

Permalink
added option of custom description translation key that could be set …
Browse files Browse the repository at this point in the history
…in the schema object
  • Loading branch information
sgempi committed Jul 5, 2024
1 parent bf1dd9c commit a168047
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 1 addition & 3 deletions backend/models/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ const retentionPolicy = {} as {
min: number
required: true
validate: { validator: any; message: string }
description: string
}
}
for (const policy of retention) {
Expand All @@ -74,8 +73,7 @@ for (const policy of retention) {
validate: {
validator: Number.isInteger,
message: 'Must be Integer'
},
description: ''
}
}
}

Expand Down
14 changes: 12 additions & 2 deletions backend/models/vueformGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,25 @@ function mapSchemaTypeToVueformElement(
vueformElement['rules'].push('max:' + schemaType.max)
}

if (schemaType.description !== undefined) {
vueformElement['description'] = translate('description.' + labelStr, language)
if (schemaType.description) {
vueformElement['description'] = translate(schemaType.description, language)
} else if (labelStr) {
let description = translate('description.' + labelStr, language) as { de: string; en: string }
if (description.de) {
console.log(description.de)
console.log('description.' + labelStr)
if (!(description.de === 'description.' + labelStr)) {
vueformElement['description'] = translate('description.' + labelStr, language)
}
}
}

if (schemaType.label) {
vueformElement['label'] = translate(schemaType.label, language)
} else if (labelStr) {
vueformElement['label'] = translate('labels.' + labelStr, language)
}

if (schemaType.info) {
vueformElement['info'] = translate(schemaType.info, language)
}
Expand Down

0 comments on commit a168047

Please sign in to comment.