Merge pull request #8957 from rusikv/bug/not-working-custom-translation-inbox-notifications

Fix for custom translation in inbox notifications table
This commit is contained in:
Igor Kulikov 2023-07-20 11:05:00 +03:00 committed by GitHub
commit ee8336aabf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,7 @@ import {
} from '@home/pages/notification/inbox/inbox-notification-dialog.component';
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
import { UtilsService } from '@core/services/utils.service';
@Injectable()
export class InboxTableConfigResolver implements Resolve<EntityTableConfig<Notification>> {
@ -48,7 +49,8 @@ export class InboxTableConfigResolver implements Resolve<EntityTableConfig<Notif
constructor(private notificationService: NotificationService,
private translate: TranslateService,
private dialog: MatDialog,
private datePipe: DatePipe) {
private datePipe: DatePipe,
private utilsService: UtilsService) {
this.config.entityType = EntityType.NOTIFICATION;
this.config.detailsPanelEnabled = false;
@ -92,8 +94,10 @@ export class InboxTableConfigResolver implements Resolve<EntityTableConfig<Notif
new DateEntityTableColumn<Notification>('createdTime', 'common.created-time', this.datePipe, '170px'),
new EntityTableColumn<Notification>('type', 'notification.type', '10%', (notification) =>
this.translate.instant(NotificationTemplateTypeTranslateMap.get(notification.type).name)),
new EntityTableColumn<Notification>('subject', 'notification.subject', '30%'),
new EntityTableColumn<Notification>('text', 'notification.message', '60%')
new EntityTableColumn<Notification>('subject', 'notification.subject', '30%',
(entity) => this.utilsService.customTranslation(entity.subject, entity.subject)),
new EntityTableColumn<Notification>('text', 'notification.message', '60%',
(entity) => this.utilsService.customTranslation(entity.text, entity.text))
);
}