ngx-translate-all-pipe
v12.0.2
Published
ngx-translate extension to translate multiple values at once
Downloads
5
Maintainers
Readme
ngx-translate-all-pipe
A modification of ngx-translate's TranslatePipe that can provide multiple translations at once.
Installation
To install this library, run:
$ npm install ngx-translate-all-pipe --save
Usage
Import TranslateAllPipeModule
.
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
TranslateModule.forRoot(),
TranslateAllPipeModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {
}
Use the translateAll
pipe in a template to translate an array of strings.
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
fruitKeys = ['APPLE', 'BANANA', 'ORANGE', 'PINEAPPLE'];
constructor(translateService: TranslateService) {
translateService.setDefaultLang('es');
}
}
In app.component.html:
{{ (fruitKeys | translateAll).join(' | ') }}
License
MIT © b4rd