ngx-translate-all-pipe
TypeScript icon, indicating that this package has built-in type declarations

12.0.2 • Public • Published

ngx-translate-all-pipe

NPM version MIT License

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

Package Sidebar

Install

npm i ngx-translate-all-pipe

Weekly Downloads

1

Version

12.0.2

License

MIT

Unpacked Size

120 kB

Total Files

21

Last publish

Collaborators

  • b4rd