@viberlab/translate-loader
TypeScript icon, indicating that this package has built-in type declarations

7.0.1 • Public • Published

VbrTranslateLoader

@viberlab/translate-loader

VbrTranslateLoader

This loader should be used within TranslateModule (Write & use your own loader)

Loader able to load and merge translation from multiple translation loaders. It implements TranslateLoader, while each loader it uses implements TranslateLoader as well.

Loader can be configured to ignore failed loaders, they will be ignored and partial translations will be used.

Usage Example:

// Usage with TranslateHttpLoader from https://github.com/ngx-translate/http-loader
function createTranslateLoader(http: HttpClient) {

  return new VbrTranslateLoader(
    // Array of loaders to be used.
    [
      new TranslateHttpLoader(http, 'assets/@viberlab/translations/locale-', '.json'),
      new TranslateHttpLoader(http, 'assets/translations/locale-', '.json')
    ],
     true // Set to ignore failed loaders
  );
}

...
// In AppModule imports:

imports: [
  TranslateModule.forRoot({
    loader: {
      provide: TranslateLoader,
      useFactory: (createTranslateLoader),
      deps: [HttpClient]
    }
  }),
]

Readme

Keywords

none

Package Sidebar

Install

npm i @viberlab/translate-loader

Weekly Downloads

0

Version

7.0.1

License

Apache-2.0

Unpacked Size

63.5 kB

Total Files

22

Last publish

Collaborators

  • askelip
  • dmitrienco
  • aharonh
  • romang
  • tamarerlich