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