mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 05:53:03 +00:00
fix the labels on edit collection and community pages
This commit is contained in:
@@ -9,6 +9,7 @@ import { DynamicFormControlModel } from '@ng-dynamic-forms/core/src/model/dynami
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||
import { MetadataMap, MetadataValue } from '../../../core/shared/metadata.models';
|
||||
import { ResourceType } from '../../../core/shared/resource-type';
|
||||
import { isNotEmpty } from '../../empty.util';
|
||||
import { Community } from '../../../core/shared/community.model';
|
||||
|
||||
@@ -29,7 +30,7 @@ export class ComColFormComponent<T extends DSpaceObject> implements OnInit {
|
||||
/**
|
||||
* Type of DSpaceObject that the form represents
|
||||
*/
|
||||
protected type;
|
||||
protected type: ResourceType;
|
||||
|
||||
/**
|
||||
* @type {string} Key prefix used to generate form labels
|
||||
@@ -110,11 +111,11 @@ export class ComColFormComponent<T extends DSpaceObject> implements OnInit {
|
||||
private updateFieldTranslations() {
|
||||
this.formModel.forEach(
|
||||
(fieldModel: DynamicInputModel) => {
|
||||
fieldModel.label = this.translate.instant(this.type + this.LABEL_KEY_PREFIX + fieldModel.id);
|
||||
fieldModel.label = this.translate.instant(this.type.value + this.LABEL_KEY_PREFIX + fieldModel.id);
|
||||
if (isNotEmpty(fieldModel.validators)) {
|
||||
fieldModel.errorMessages = {};
|
||||
Object.keys(fieldModel.validators).forEach((key) => {
|
||||
fieldModel.errorMessages[key] = this.translate.instant(this.type + this.ERROR_KEY_PREFIX + fieldModel.id + '.' + key);
|
||||
fieldModel.errorMessages[key] = this.translate.instant(this.type.value + this.ERROR_KEY_PREFIX + fieldModel.id + '.' + key);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user