create new translate pipe and remove TranslateCatalogPipe
This commit is contained in:
committed by
Jose Alberto Hernandez
parent
c4d0eac2e3
commit
9a0124d358
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user