diff options
author | Chocobozzz <me@florianbigard.com> | 2020-02-07 15:51:19 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-02-10 16:39:28 +0100 |
commit | 361dcebc75dea74947b6c3aafd9d7d720c054b01 (patch) | |
tree | 5edf2a0d871097ba7da2b974b8ccdef9c6b73261 /client/src/app/app.module.ts | |
parent | f77eb73b5e02bed9e223dafc1c203ceb7c05b6e5 (diff) | |
download | PeerTube-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.ts | 13 |
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' | |||
4 | import { ResetPasswordModule } from '@app/reset-password' | 4 | import { ResetPasswordModule } from '@app/reset-password' |
5 | 5 | ||
6 | import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core' | 6 | import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core' |
7 | import { ClipboardModule } from 'ngx-clipboard' | ||
8 | import 'focus-visible' | 7 | import 'focus-visible' |
9 | 8 | ||
10 | import { AppRoutingModule } from './app-routing.module' | 9 | import { AppRoutingModule } from './app-routing.module' |
@@ -15,11 +14,10 @@ import { LoginModule } from './login' | |||
15 | import { AvatarNotificationComponent, LanguageChooserComponent, MenuComponent } from './menu' | 14 | import { AvatarNotificationComponent, LanguageChooserComponent, MenuComponent } from './menu' |
16 | import { SharedModule } from './shared' | 15 | import { SharedModule } from './shared' |
17 | import { VideosModule } from './videos' | 16 | import { VideosModule } from './videos' |
18 | import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '../../../shared/models/i18n' | ||
19 | import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils' | ||
20 | import { SearchModule } from '@app/search' | 17 | import { SearchModule } from '@app/search' |
21 | import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' | 18 | import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' |
22 | import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component' | 19 | import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component' |
20 | import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models' | ||
23 | 21 | ||
24 | export function metaFactory (serverService: ServerService): MetaLoader { | 22 | export 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 | ||