aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app.module.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-02-07 15:51:19 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-02-10 16:39:28 +0100
commit361dcebc75dea74947b6c3aafd9d7d720c054b01 (patch)
tree5edf2a0d871097ba7da2b974b8ccdef9c6b73261 /client/src/app/app.module.ts
parentf77eb73b5e02bed9e223dafc1c203ceb7c05b6e5 (diff)
downloadPeerTube-361dcebc75dea74947b6c3aafd9d7d720c054b01.tar.gz
PeerTube-361dcebc75dea74947b6c3aafd9d7d720c054b01.tar.zst
PeerTube-361dcebc75dea74947b6c3aafd9d7d720c054b01.zip
Support i18n build
Diffstat (limited to 'client/src/app/app.module.ts')
-rw-r--r--client/src/app/app.module.ts13
1 files changed, 3 insertions, 10 deletions
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts
index 62915ec54..14fdb7588 100644
--- a/client/src/app/app.module.ts
+++ b/client/src/app/app.module.ts
@@ -4,7 +4,6 @@ import { ServerService } from '@app/core'
4import { ResetPasswordModule } from '@app/reset-password' 4import { ResetPasswordModule } from '@app/reset-password'
5 5
6import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core' 6import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core'
7import { ClipboardModule } from 'ngx-clipboard'
8import 'focus-visible' 7import 'focus-visible'
9 8
10import { AppRoutingModule } from './app-routing.module' 9import { AppRoutingModule } from './app-routing.module'
@@ -15,11 +14,10 @@ import { LoginModule } from './login'
15import { AvatarNotificationComponent, LanguageChooserComponent, MenuComponent } from './menu' 14import { AvatarNotificationComponent, LanguageChooserComponent, MenuComponent } from './menu'
16import { SharedModule } from './shared' 15import { SharedModule } from './shared'
17import { VideosModule } from './videos' 16import { VideosModule } from './videos'
18import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '../../../shared/models/i18n'
19import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils'
20import { SearchModule } from '@app/search' 17import { SearchModule } from '@app/search'
21import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' 18import { WelcomeModalComponent } from '@app/modal/welcome-modal.component'
22import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component' 19import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component'
20import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models'
23 21
24export function metaFactory (serverService: ServerService): MetaLoader { 22export function metaFactory (serverService: ServerService): MetaLoader {
25 return new MetaStaticLoader({ 23 return new MetaStaticLoader({
@@ -67,17 +65,12 @@ export function metaFactory (serverService: ServerService): MetaLoader {
67 65
68 AppRoutingModule // Put it after all the module because it has the 404 route 66 AppRoutingModule // Put it after all the module because it has the 404 route
69 ], 67 ],
68
70 providers: [ 69 providers: [
71 { 70 {
72 provide: TRANSLATIONS, 71 provide: TRANSLATIONS,
73 useFactory: (locale: string) => { 72 useFactory: (locale: string) => {
74 // On dev mode, test localization 73 // Default locale, nothing to translate
75 if (isOnDevLocale()) {
76 locale = buildFileLocale(getDevLocale())
77 return require(`raw-loader!../locale/angular.${locale}.xlf`)
78 }
79
80 // Default locale, nothing to translate
81 const completeLocale = getCompleteLocale(locale) 74 const completeLocale = getCompleteLocale(locale)
82 if (isDefaultLocale(completeLocale)) return '' 75 if (isDefaultLocale(completeLocale)) return ''
83 76