1 import { LOCALE_ID, NgModule, TRANSLATIONS, TRANSLATIONS_FORMAT } from '@angular/core'
2 import { BrowserModule } from '@angular/platform-browser'
3 import { ServerService } from '@app/core'
4 import { ResetPasswordModule } from '@app/reset-password'
5 import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core'
8 import { AppRoutingModule } from './app-routing.module'
9 import { AppComponent } from './app.component'
10 import { CoreModule } from './core'
11 import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header'
12 import { LoginModule } from './login'
13 import { AvatarNotificationComponent, LanguageChooserComponent, MenuComponent } from './menu'
14 import { SharedModule } from './shared'
15 import { VideosModule } from './videos'
16 import { SearchModule } from '@app/search'
17 import { WelcomeModalComponent } from '@app/modal/welcome-modal.component'
18 import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component'
19 import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models'
20 import { APP_BASE_HREF, registerLocaleData } from '@angular/common'
21 import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'
22 import { CustomModalComponent } from '@app/modal/custom-modal.component'
23 import localeOc from '@app/shared/locale/oc'
25 registerLocaleData(localeOc, 'oc')
28 bootstrap: [ AppComponent ],
33 LanguageChooserComponent,
34 QuickSettingsModalComponent,
35 AvatarNotificationComponent,
37 SearchTypeaheadComponent,
41 WelcomeModalComponent,
42 InstanceConfigWarningModalComponent
59 useFactory: (serverService: ServerService) => {
60 return new MetaStaticLoader({
61 pageTitlePositioning: PageTitlePositioning.PrependPageTitle,
62 pageTitleSeparator: ' - ',
63 get applicationName () { return serverService.getTmpConfig().instance.name },
65 get title () { return serverService.getTmpConfig().instance.name },
66 get description () { return serverService.getTmpConfig().instance.shortDescription }
70 deps: [ ServerService ]
73 AppRoutingModule // Put it after all the module because it has the 404 route
78 provide: APP_BASE_HREF,
83 provide: TRANSLATIONS,
84 useFactory: (locale: string) => {
85 // Default locale, nothing to translate
86 const completeLocale = getCompleteLocale(locale)
87 if (isDefaultLocale(completeLocale)) return ''
89 const fileLocale = buildFileLocale(locale)
90 return require(`raw-loader!../locale/angular.${fileLocale}.xlf`).default
94 { provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }
97 export class AppModule {}