X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fapp.module.ts;h=51e35437824629f8ca399ff78ed99a4e97507007;hb=3baf9be283d75cddc8aab918e6d6557371fbd9e9;hp=44552021f3aedcbb351f35c52d4c00b239c14552;hpb=989e526abf0c0dd7958deb630df009608561bb67;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index 44552021f..51e354378 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts @@ -16,7 +16,8 @@ import { MenuComponent } from './menu' import { SharedModule } from './shared' import { SignupModule } from './signup' import { VideosModule } from './videos' -import { buildFileLocale, getDefaultLocale } from '../../../shared/models/i18n' +import { buildFileLocale, getCompleteLocale, getDefaultLocale, isDefaultLocale } from '../../../shared/models/i18n' +import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils' export function metaFactory (serverService: ServerService): MetaLoader { return new MetaStaticLoader({ @@ -66,13 +67,18 @@ export function metaFactory (serverService: ServerService): MetaLoader { { provide: TRANSLATIONS, useFactory: (locale) => { - const fileLocale = buildFileLocale(locale) + // On dev mode, test localization + if (isOnDevLocale()) { + locale = getDevLocale() + return require(`raw-loader!../locale/target/angular_${locale}.xml`) + } // Default locale, nothing to translate - const defaultFileLocale = buildFileLocale(getDefaultLocale()) - if (fileLocale === defaultFileLocale) return '' + const completeLocale = getCompleteLocale(locale) + if (isDefaultLocale(completeLocale)) return '' - return require(`raw-loader!../locale/target/messages_${fileLocale}.xml`) + const fileLocale = buildFileLocale(locale) + return require(`raw-loader!../locale/target/angular_${fileLocale}.xml`) }, deps: [ LOCALE_ID ] },