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.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts
index e60a74cc0..51e354378 100644
--- a/client/src/app/app.module.ts
+++ b/client/src/app/app.module.ts
@@ -16,8 +16,8 @@ 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' 19import { buildFileLocale, getCompleteLocale, getDefaultLocale, isDefaultLocale } from '../../../shared/models/i18n'
20import { environment } from '../environments/environment' 20import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils'
21 21
22export function metaFactory (serverService: ServerService): MetaLoader { 22export function metaFactory (serverService: ServerService): MetaLoader {
23 return new MetaStaticLoader({ 23 return new MetaStaticLoader({
@@ -67,17 +67,17 @@ export function metaFactory (serverService: ServerService): MetaLoader {
67 { 67 {
68 provide: TRANSLATIONS, 68 provide: TRANSLATIONS,
69 useFactory: (locale) => { 69 useFactory: (locale) => {
70 // On dev mode, test locales 70 // On dev mode, test localization
71 if (environment.production === false && window.location.search === '?lang=fr') { 71 if (isOnDevLocale()) {
72 return require(`raw-loader!../locale/target/angular_fr.xml`) 72 locale = getDevLocale()
73 return require(`raw-loader!../locale/target/angular_${locale}.xml`)
73 } 74 }
74 75
75 const fileLocale = buildFileLocale(locale)
76
77 // Default locale, nothing to translate 76 // Default locale, nothing to translate
78 const defaultFileLocale = buildFileLocale(getDefaultLocale()) 77 const completeLocale = getCompleteLocale(locale)
79 if (fileLocale === defaultFileLocale) return '' 78 if (isDefaultLocale(completeLocale)) return ''
80 79
80 const fileLocale = buildFileLocale(locale)
81 return require(`raw-loader!../locale/target/angular_${fileLocale}.xml`) 81 return require(`raw-loader!../locale/target/angular_${fileLocale}.xml`)
82 }, 82 },
83 deps: [ LOCALE_ID ] 83 deps: [ LOCALE_ID ]