create new translate pipe and remove TranslateCatalogPipe

This commit is contained in:
Omar-Nabil
2024-06-03 15:17:41 -06:00
committed by Jose Alberto Hernandez
parent c4d0eac2e3
commit 9a0124d358
53 changed files with 243 additions and 206 deletions
+16
View File
@@ -0,0 +1,16 @@
import { Pipe, PipeTransform } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
@Pipe({
name: 'translateKey'
})
export class TranslatePipe implements PipeTransform {
constructor(private translateService: TranslateService) { }
transform(attributeValue: any, group: string, prefix: string = 'labels'): string {
const translationKey = `${prefix}.${group}.${attributeValue}`;
return this.translateService.instant(translationKey);
}
}