-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create new translate pipe and remove TranslateCatalogPipe
- Loading branch information
1 parent
c4d0eac
commit 9a0124d
Showing
53 changed files
with
243 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* tslint:disable:no-unused-variable */ | ||
|
||
import { TestBed, async } from '@angular/core/testing'; | ||
import { TranslatePipe } from './translate.pipe'; | ||
|
||
describe('Pipe: Translatee', () => { | ||
it('create an instance', () => { | ||
let pipe = new TranslatePipe(); | ||
expect(pipe).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
|
||
} |
Oops, something went wrong.