diff options
Diffstat (limited to 'client/src/app/app.module.ts')
-rw-r--r-- | client/src/app/app.module.ts | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index cf533629f..44552021f 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { NgModule } from '@angular/core' | 1 | import { LOCALE_ID, NgModule, TRANSLATIONS, TRANSLATIONS_FORMAT } from '@angular/core' |
2 | import { BrowserModule } from '@angular/platform-browser' | 2 | import { BrowserModule } from '@angular/platform-browser' |
3 | import { AboutModule } from '@app/about' | 3 | import { AboutModule } from '@app/about' |
4 | import { ServerService } from '@app/core' | 4 | import { ServerService } from '@app/core' |
@@ -16,6 +16,7 @@ import { MenuComponent } from './menu' | |||
16 | import { SharedModule } from './shared' | 16 | import { SharedModule } from './shared' |
17 | import { SignupModule } from './signup' | 17 | import { SignupModule } from './signup' |
18 | import { VideosModule } from './videos' | 18 | import { VideosModule } from './videos' |
19 | import { buildFileLocale, getDefaultLocale } from '../../../shared/models/i18n' | ||
19 | 20 | ||
20 | export function metaFactory (serverService: ServerService): MetaLoader { | 21 | export function metaFactory (serverService: ServerService): MetaLoader { |
21 | return new MetaStaticLoader({ | 22 | return new MetaStaticLoader({ |
@@ -61,6 +62,21 @@ export function metaFactory (serverService: ServerService): MetaLoader { | |||
61 | 62 | ||
62 | AppRoutingModule // Put it after all the module because it has the 404 route | 63 | AppRoutingModule // Put it after all the module because it has the 404 route |
63 | ], | 64 | ], |
64 | providers: [ ] | 65 | providers: [ |
66 | { | ||
67 | provide: TRANSLATIONS, | ||
68 | useFactory: (locale) => { | ||
69 | const fileLocale = buildFileLocale(locale) | ||
70 | |||
71 | // Default locale, nothing to translate | ||
72 | const defaultFileLocale = buildFileLocale(getDefaultLocale()) | ||
73 | if (fileLocale === defaultFileLocale) return '' | ||
74 | |||
75 | return require(`raw-loader!../locale/target/messages_${fileLocale}.xml`) | ||
76 | }, | ||
77 | deps: [ LOCALE_ID ] | ||
78 | }, | ||
79 | { provide: TRANSLATIONS_FORMAT, useValue: 'xlf' } | ||
80 | ] | ||
65 | }) | 81 | }) |
66 | export class AppModule {} | 82 | export class AppModule {} |