]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/app.module.ts
Fix deleting highlighted thread
[github/Chocobozzz/PeerTube.git] / client / src / app / app.module.ts
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
6 import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core'
7 import 'focus-visible'
8
9 import { AppRoutingModule } from './app-routing.module'
10 import { AppComponent } from './app.component'
11 import { CoreModule } from './core'
12 import { HeaderComponent, SearchTypeaheadComponent, SuggestionsComponent, SuggestionComponent } from './header'
13 import { LoginModule } from './login'
14 import { AvatarNotificationComponent, LanguageChooserComponent, MenuComponent } from './menu'
15 import { SharedModule } from './shared'
16 import { VideosModule } from './videos'
17 import { SearchModule } from '@app/search'
18 import { WelcomeModalComponent } from '@app/modal/welcome-modal.component'
19 import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component'
20 import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models'
21 import { APP_BASE_HREF } from '@angular/common'
22 import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'
23 import { CustomModalComponent } from '@app/modal/custom-modal.component'
24
25 @NgModule({
26 bootstrap: [ AppComponent ],
27 declarations: [
28 AppComponent,
29
30 MenuComponent,
31 LanguageChooserComponent,
32 QuickSettingsModalComponent,
33 AvatarNotificationComponent,
34 HeaderComponent,
35 SearchTypeaheadComponent,
36 SuggestionsComponent,
37 SuggestionComponent,
38
39 CustomModalComponent,
40 WelcomeModalComponent,
41 InstanceConfigWarningModalComponent
42 ],
43 imports: [
44 BrowserModule,
45
46 CoreModule,
47 SharedModule,
48
49 CoreModule,
50 LoginModule,
51 ResetPasswordModule,
52 SearchModule,
53 SharedModule,
54 VideosModule,
55
56 MetaModule.forRoot({
57 provide: MetaLoader,
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 },
69 deps: [ ServerService ]
70 }),
71
72 AppRoutingModule // Put it after all the module because it has the 404 route
73 ],
74
75 providers: [
76 {
77 provide: APP_BASE_HREF,
78 useValue: '/'
79 },
80
81 {
82 provide: TRANSLATIONS,
83 useFactory: (locale: string) => {
84 // Default locale, nothing to translate
85 const completeLocale = getCompleteLocale(locale)
86 if (isDefaultLocale(completeLocale)) return ''
87
88 const fileLocale = buildFileLocale(locale)
89 return require(`raw-loader!../locale/angular.${fileLocale}.xlf`).default
90 },
91 deps: [ LOCALE_ID ]
92 },
93 { provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }
94 ]
95 })
96 export class AppModule {}