]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/app.module.ts
First implem global search
[github/Chocobozzz/PeerTube.git] / client / src / app / app.module.ts
CommitLineData
989e526a 1import { LOCALE_ID, NgModule, TRANSLATIONS, TRANSLATIONS_FORMAT } from '@angular/core'
df98563e 2import { BrowserModule } from '@angular/platform-browser'
63ac2857 3import { ServerService } from '@app/core'
ecb4e35f 4import { ResetPasswordModule } from '@app/reset-password'
ecb4e35f 5import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core'
e78980eb 6import 'focus-visible'
ecb4e35f 7
df98563e
C
8import { AppRoutingModule } from './app-routing.module'
9import { AppComponent } from './app.component'
df98563e 10import { CoreModule } from './core'
5fb2e288 11import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header'
df98563e 12import { LoginModule } from './login'
2f1548fd 13import { AvatarNotificationComponent, LanguageChooserComponent, MenuComponent } from './menu'
df98563e
C
14import { SharedModule } from './shared'
15import { VideosModule } from './videos'
57c36b27 16import { SearchModule } from '@app/search'
43d0ea7f
C
17import { WelcomeModalComponent } from '@app/modal/welcome-modal.component'
18import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component'
361dcebc 19import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models'
2a39506c 20import { APP_BASE_HREF, registerLocaleData } from '@angular/common'
d3217560 21import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'
437e8e06 22import { CustomModalComponent } from '@app/modal/custom-modal.component'
2a39506c
C
23import localeOc from '@app/shared/locale/oc'
24
25registerLocaleData(localeOc, 'oc')
693b1aba 26
ab32b0fc
C
27@NgModule({
28 bootstrap: [ AppComponent ],
29 declarations: [
b33f657c
C
30 AppComponent,
31
32 MenuComponent,
8afc19a6 33 LanguageChooserComponent,
d3217560 34 QuickSettingsModalComponent,
2f1548fd 35 AvatarNotificationComponent,
43d0ea7f 36 HeaderComponent,
f409f0c3 37 SearchTypeaheadComponent,
6af662a5 38 SuggestionComponent,
43d0ea7f 39
437e8e06 40 CustomModalComponent,
43d0ea7f
C
41 WelcomeModalComponent,
42 InstanceConfigWarningModalComponent
ab32b0fc 43 ],
693b1aba 44 imports: [
ab32b0fc 45 BrowserModule,
23bcf666 46
693b1aba
C
47 CoreModule,
48 SharedModule,
49
693b1aba
C
50 CoreModule,
51 LoginModule,
ecb4e35f 52 ResetPasswordModule,
57c36b27 53 SearchModule,
693b1aba 54 SharedModule,
55b33946
C
55 VideosModule,
56
57 MetaModule.forRoot({
58 provide: MetaLoader,
399b3bc9
C
59 useFactory: (serverService: ServerService) => {
60 return new MetaStaticLoader({
61 pageTitlePositioning: PageTitlePositioning.PrependPageTitle,
62 pageTitleSeparator: ' - ',
63 get applicationName () { return serverService.getTmpConfig().instance.name },
64 defaults: {
65 get title () { return serverService.getTmpConfig().instance.name },
66 get description () { return serverService.getTmpConfig().instance.shortDescription }
67 }
68 })
69 },
63ac2857 70 deps: [ ServerService ]
a51bad1a
C
71 }),
72
a9614776 73 AppRoutingModule // Put it after all the module because it has the 404 route
ab32b0fc 74 ],
361dcebc 75
989e526a 76 providers: [
8cc56c7f
C
77 {
78 provide: APP_BASE_HREF,
79 useValue: '/'
80 },
81
989e526a
C
82 {
83 provide: TRANSLATIONS,
244b4ae3 84 useFactory: (locale: string) => {
1fe654e0 85 // Default locale, nothing to translate
74b7c6d4
C
86 const completeLocale = getCompleteLocale(locale)
87 if (isDefaultLocale(completeLocale)) return ''
989e526a 88
74b7c6d4 89 const fileLocale = buildFileLocale(locale)
1fe654e0 90 return require(`raw-loader!../locale/angular.${fileLocale}.xlf`).default
989e526a
C
91 },
92 deps: [ LOCALE_ID ]
93 },
94 { provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }
95 ]
ab32b0fc 96})
63c4db6d 97export class AppModule {}