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