This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {HttpClient} from "@angular/common/http"; | |
| import {TranslateLoader} from "@ngx-translate/core"; | |
| import {Observable} from 'rxjs'; | |
| export class TranslateHttpLoader implements TranslateLoader { | |
| constructor(private http: HttpClient, public prefix: string = "/assets/i18n/", public suffix: string = ".json") {} | |
| /** | |
| * Gets the translations from the server | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "assets": [ | |
| "src/favicon.ico", | |
| "src/assets", | |
| { | |
| "glob": "**/*.*", | |
| "input": "src/app/core/i18n/common", | |
| "output": "assets/i18n/common" | |
| }, | |
| { | |
| "glob": "**/*.*", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @NgModule({ | |
| declarations: [ | |
| FeatureOneComponent | |
| ], | |
| imports: [ | |
| CommonModule, | |
| TranslateModule.forRoot({ | |
| loader: { | |
| provide: TranslateLoader, | |
| useFactory: (httpClient: HttpClient) => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class TranslationLoaderService extends TranslateLoader { | |
| constructor(private http: HttpClient, private moduleName: string) { | |
| super(); | |
| } | |
| getTranslation(lang: string): Observable<any> { | |
| return forkJoin({ | |
| moduleTranslation: this.http.get(`/assets/i18n/${moduleName}/${lang}.json`), | |
| commonTranslation: this.http.get(`/assets/i18n/commons/${lang}.json`)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function createTranslateLoader(http: HttpClient) { | |
| return new TranslateHttpLoader(http, './assets/i18n/', '.json'); | |
| } | |
| @NgModule({ | |
| imports: [ | |
| BrowserModule, | |
| HttpClientModule, | |
| TranslateModule.forRoot({ | |
| loader: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Injectable} from "@angular/core"; | |
| import {Observable, of} from "rxjs"; | |
| export abstract class TranslateLoader { | |
| abstract getTranslation(lang: string): Observable<any>; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {HttpClient} from "@angular/common/http"; | |
| import {TranslateLoader} from "@ngx-translate/core"; | |
| import {Observable} from 'rxjs'; | |
| export class TranslateHttpLoader implements TranslateLoader { | |
| constructor(private http: HttpClient, public prefix: string = "/assets/i18n/", public suffix: string = ".json") {} | |
| /** | |
| * Gets the translations from the server | |
| */ |