{"library":"ngx-translate-multi-http-loader","title":"ngx-translate Multi HTTP Loader","description":"ngx-translate-multi-http-loader is an Angular-specific HTTP loader for the `@ngx-translate/core` library, designed to fetch translation files from multiple distinct HTTP endpoints. Currently in version 20.0.0, this package typically releases new major versions aligned with Angular's major release cycle, ensuring compatibility with the latest Angular ecosystem. Its primary differentiator is the ability to consolidate translations from various sources (e.g., core application, feature modules, third-party vendors) into a single translation service instance. Crucially, it leverages `HttpBackend` directly instead of `HttpClient`, which allows it to bypass HTTP interceptors by default. This design choice prevents potential delays or conflicts with interceptors that might otherwise interfere with the initial loading of translation files, which often occurs early in the application bootstrap process. It primarily supports JSON format for translation files.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install ngx-translate-multi-http-loader"],"cli":null},"imports":["import { MultiTranslateHttpLoader } from 'ngx-translate-multi-http-loader';","export function HttpLoaderFactory(httpBackend: HttpBackend) { return new MultiTranslateHttpLoader(httpBackend, ['/assets/i18n/']); }","import { TranslationResource } from 'ngx-translate-multi-http-loader';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { NgModule } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\nimport { HttpClientModule, HttpBackend } from '@angular/common/http';\nimport { TranslateModule, TranslateLoader } from '@ngx-translate/core';\nimport { MultiTranslateHttpLoader } from 'ngx-translate-multi-http-loader';\nimport { AppComponent } from './app.component'; // Assuming you have an AppComponent\n\n// AoT requires an exported function for factories\nexport function HttpLoaderFactory(_httpBackend: HttpBackend) {\n  // Example: loading from two different paths, 'core' and 'vendors'\n  return new MultiTranslateHttpLoader(_httpBackend, [\n    '/assets/i18n/core/', \n    '/assets/i18n/vendors/' \n  ]);\n}\n\n@NgModule({\n  declarations: [\n    AppComponent\n  ],\n  imports: [\n    BrowserModule,\n    HttpClientModule,\n    TranslateModule.forRoot({\n      loader: {\n        provide: TranslateLoader,\n        useFactory: HttpLoaderFactory,\n        deps: [HttpBackend]\n      }\n    })\n  ],\n  providers: [],\n  bootstrap: [AppComponent]\n})\nexport class AppModule { }","lang":"typescript","description":"This quickstart demonstrates the setup of `MultiTranslateHttpLoader` within an Angular `AppModule`. It configures `@ngx-translate/core` to use `MultiTranslateHttpLoader` with a factory function, loading translations from two distinct `/assets/i18n/` subdirectories, ensuring AoT compatibility and correct dependency injection of `HttpBackend`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}