aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app.module.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/app.module.ts')
-rw-r--r--client/src/app/app.module.ts20
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 @@
1import { NgModule } from '@angular/core' 1import { LOCALE_ID, NgModule, TRANSLATIONS, TRANSLATIONS_FORMAT } from '@angular/core'
2import { BrowserModule } from '@angular/platform-browser' 2import { BrowserModule } from '@angular/platform-browser'
3import { AboutModule } from '@app/about' 3import { AboutModule } from '@app/about'
4import { ServerService } from '@app/core' 4import { ServerService } from '@app/core'
@@ -16,6 +16,7 @@ import { MenuComponent } from './menu'
16import { SharedModule } from './shared' 16import { SharedModule } from './shared'
17import { SignupModule } from './signup' 17import { SignupModule } from './signup'
18import { VideosModule } from './videos' 18import { VideosModule } from './videos'
19import { buildFileLocale, getDefaultLocale } from '../../../shared/models/i18n'
19 20
20export function metaFactory (serverService: ServerService): MetaLoader { 21export 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})
66export class AppModule {} 82export class AppModule {}