You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Get the complete changelog here: https://github.com/denniske/ngx-translate-multi-http-loader/releases
10
11
11
12
*[Installation](#installation)
12
13
*[Usage](#usage)
13
14
15
+
## breaking change: v9.0.0
16
+
* This library is now using `httpBackend` instead of the `httpClient`, to avoid being delayed by interceptor, which was creating errors while loading.
17
+
* From the v9, the library will only be using a list of `string[]` so `prefix` & `suffix` aren't needed anymore and `.json` gonna be the default suffix.
18
+
14
19
## Installation
15
20
16
21
We assume that you already installed [ngx-translate](https://github.com/ngx-translate/core).
#### 1. Setup the `TranslateModule` to use the `MultiTranslateHttpLoader`:
38
+
_The `MultiTranslateHttpLoader` uses HttpBackend to load translations, therefore :_
39
+
1. Create and export a new `HttpLoaderFactory` function
40
+
2. Import the `HttpClientModule` from `@angular/common/http`
41
+
3. Setup the `TranslateModule` to use the `MultiTranslateHttpLoader`
34
42
35
-
The `MultiTranslateHttpLoader` uses HttpClient to load translations, which means that you have to import the HttpClientModule from `@angular/common/http` before the `TranslateModule`:
@@ -59,7 +61,7 @@ export function HttpLoaderFactory(http: HttpClient) {
59
61
loader: {
60
62
provide: TranslateLoader,
61
63
useFactory: HttpLoaderFactory,
62
-
deps: [HttpClient]
64
+
deps: [HttpBackend]
63
65
}
64
66
})
65
67
],
@@ -68,23 +70,10 @@ export function HttpLoaderFactory(http: HttpClient) {
68
70
exportclassAppModule { }
69
71
```
70
72
71
-
The `MultiTranslateHttpLoader` takes a list of translation file configurations. Each configuration has two optional parameters:
72
-
- prefix: string = "/assets/translate/"
73
-
- suffix: string = ".json"
74
-
75
-
By using those default parameters, it will load your translations files for the lang "en" from: `/assets/translate/en.json`.
73
+
The `MultiTranslateHttpLoader` takes a list of strings.
76
74
77
-
You can change those in the `HttpLoaderFactory` method that we just defined. For example if you want to load the "en" translations from `/assets/translate/core/en.json` and `/assets/translate/shared/en.json` you would use:
0 commit comments