]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/app.module.ts
Creating a user with an empty password will send an email to let him set his password...
[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'
693b1aba 22
63ac2857 23export function metaFactory (serverService: ServerService): MetaLoader {
758b996d
C
24 return new MetaStaticLoader({
25 pageTitlePositioning: PageTitlePositioning.PrependPageTitle,
26 pageTitleSeparator: ' - ',
ba430d75 27 get applicationName () { return serverService.getTmpConfig().instance.name },
758b996d 28 defaults: {
ba430d75
C
29 get title () { return serverService.getTmpConfig().instance.name },
30 get description () { return serverService.getTmpConfig().instance.shortDescription }
758b996d 31 }
df98563e 32 })
758b996d 33}
b58c69a1 34
ab32b0fc
C
35@NgModule({
36 bootstrap: [ AppComponent ],
37 declarations: [
b33f657c
C
38 AppComponent,
39
40 MenuComponent,
8afc19a6 41 LanguageChooserComponent,
2f1548fd 42 AvatarNotificationComponent,
43d0ea7f 43 HeaderComponent,
f409f0c3 44 SearchTypeaheadComponent,
6af662a5
RK
45 SuggestionsComponent,
46 SuggestionComponent,
43d0ea7f
C
47
48 WelcomeModalComponent,
49 InstanceConfigWarningModalComponent
ab32b0fc 50 ],
693b1aba 51 imports: [
ab32b0fc 52 BrowserModule,
23bcf666 53
693b1aba
C
54 CoreModule,
55 SharedModule,
56
693b1aba
C
57 CoreModule,
58 LoginModule,
ecb4e35f 59 ResetPasswordModule,
57c36b27 60 SearchModule,
693b1aba 61 SharedModule,
55b33946
C
62 VideosModule,
63
64 MetaModule.forRoot({
65 provide: MetaLoader,
63ac2857
C
66 useFactory: (metaFactory),
67 deps: [ ServerService ]
a51bad1a
C
68 }),
69
a9614776 70 AppRoutingModule // Put it after all the module because it has the 404 route
ab32b0fc 71 ],
361dcebc 72
989e526a 73 providers: [
8cc56c7f
C
74 {
75 provide: APP_BASE_HREF,
76 useValue: '/'
77 },
78
989e526a
C
79 {
80 provide: TRANSLATIONS,
244b4ae3 81 useFactory: (locale: string) => {
361dcebc 82 // Default locale, nothing to translate
74b7c6d4
C
83 const completeLocale = getCompleteLocale(locale)
84 if (isDefaultLocale(completeLocale)) return ''
989e526a 85
74b7c6d4 86 const fileLocale = buildFileLocale(locale)
350131cb 87 return require(`raw-loader!../locale/angular.${fileLocale}.xlf`)
989e526a
C
88 },
89 deps: [ LOCALE_ID ]
90 },
91 { provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }
92 ]
ab32b0fc 93})
63c4db6d 94export class AppModule {}