63669: Translated options

This commit is contained in:
Kristof De Langhe
2019-07-15 13:49:50 +02:00
parent d97fcc5c15
commit f45f390c67
2 changed files with 43 additions and 13 deletions

View File

@@ -54,6 +54,18 @@
"provider": { "provider": {
"required": "You must provide a set id of the target collection." "required": "You must provide a set id of the target collection."
} }
},
"options": {
"format": {
"dc": "Simple Dublin Core",
"qdc": "Qualified Dublin Core",
"dim": "DSpace Intermediate Metadata"
},
"harvest": {
"1": "Harvest metadata only",
"2": "Harvest metadata and references to bitstreams (requires ORE support)",
"3": "Harvest metadata and bitstreams (requires ORE support)"
}
} }
}, },
"notifications": { "notifications": {

View File

@@ -2,7 +2,7 @@ import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
import { AbstractTrackableComponent } from '../../../shared/trackable/abstract-trackable.component'; import { AbstractTrackableComponent } from '../../../shared/trackable/abstract-trackable.component';
import { import {
DynamicFormControlModel, DynamicFormGroupModel, DynamicFormLayout, DynamicFormService, DynamicFormControlModel, DynamicFormGroupModel, DynamicFormLayout, DynamicFormService,
DynamicInputModel, DynamicRadioGroupModel, DynamicInputModel, DynamicOptionControlModel, DynamicRadioGroupModel,
DynamicSelectModel, DynamicSelectModel,
DynamicTextAreaModel DynamicTextAreaModel
} from '@ng-dynamic-forms/core'; } from '@ng-dynamic-forms/core';
@@ -56,6 +56,14 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
*/ */
ERROR_KEY_PREFIX = 'collection.edit.tabs.source.form.errors.'; ERROR_KEY_PREFIX = 'collection.edit.tabs.source.form.errors.';
/**
* @type {string} Key prefix used to generate form option labels
*/
OPTIONS_KEY_PREFIX = 'collection.edit.tabs.source.form.options.';
/**
* The Dynamic Input Model for the OAI Provider
*/
providerModel = new DynamicInputModel({ providerModel = new DynamicInputModel({
id: 'provider', id: 'provider',
name: 'provider', name: 'provider',
@@ -68,45 +76,48 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
} }
}); });
/**
* The Dynamic Input Model for the OAI Set
*/
setModel = new DynamicInputModel({ setModel = new DynamicInputModel({
id: 'set', id: 'set',
name: 'set' name: 'set'
}); });
/**
* The Dynamic Input Model for the Metadata Format used
*/
formatModel = new DynamicSelectModel({ formatModel = new DynamicSelectModel({
id: 'format', id: 'format',
name: 'format', name: 'format',
options: [ options: [
{ {
value: 'dc', value: 'dc'
label: 'Simple Dublin Core'
}, },
{ {
value: 'qdc', value: 'qdc'
label: 'Qualified Dublin Core'
}, },
{ {
value: 'dim', value: 'dim'
label: 'DSpace Intermediate Metadata'
} }
] ]
}); });
/**
* The Dynamic Input Model for the type of harvesting
*/
harvestModel = new DynamicRadioGroupModel<number>({ harvestModel = new DynamicRadioGroupModel<number>({
id: 'harvest', id: 'harvest',
name: 'harvest', name: 'harvest',
options: [ options: [
{ {
value: 1, value: 1
label: 'Harvest metadata only.'
}, },
{ {
value: 2, value: 2
label: 'Harvest metadata and references to bitstreams (requires ORE support).'
}, },
{ {
value: 3, value: 3
label: 'Harvest metadata and bitstreams (requires ORE support).'
} }
] ]
}); });
@@ -283,6 +294,13 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
fieldModel.errorMessages[key] = this.translate.instant(this.ERROR_KEY_PREFIX + fieldModel.id + '.' + key); fieldModel.errorMessages[key] = this.translate.instant(this.ERROR_KEY_PREFIX + fieldModel.id + '.' + key);
}); });
} }
if (fieldModel instanceof DynamicOptionControlModel) {
if (isNotEmpty(fieldModel.options)) {
fieldModel.options.forEach((option) => {
option.label = this.translate.instant(this.OPTIONS_KEY_PREFIX + fieldModel.id + '.' + option.value);
});
}
}
} }
/** /**