Created
March 7, 2022 19:37
-
-
Save ppowstanski/0ce0059100e609f389e51f70820dc2ee to your computer and use it in GitHub Desktop.
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`)) | |
| }).pipe( | |
| map((translation: { moduleTranslation: any, commonTranslation: any }) => Object.assign( | |
| {}, | |
| translation.commonTranslation, | |
| translation.moduleTranslation | |
| )) | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment