2020-06-23 12:10:17 +00:00
|
|
|
import 'focus-visible'
|
|
|
|
import { APP_BASE_HREF, registerLocaleData } from '@angular/common'
|
2018-05-31 16:12:15 +00:00
|
|
|
import { LOCALE_ID, NgModule, TRANSLATIONS, TRANSLATIONS_FORMAT } from '@angular/core'
|
2017-06-16 12:32:15 +00:00
|
|
|
import { BrowserModule } from '@angular/platform-browser'
|
2018-03-22 13:13:30 +00:00
|
|
|
import { ServerService } from '@app/core'
|
2020-06-23 12:10:17 +00:00
|
|
|
import localeOc from '@app/helpers/locales/oc'
|
2018-01-30 12:27:07 +00:00
|
|
|
import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core'
|
2020-06-23 12:10:17 +00:00
|
|
|
import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models'
|
2017-06-16 12:32:15 +00:00
|
|
|
import { AppRoutingModule } from './app-routing.module'
|
|
|
|
import { AppComponent } from './app.component'
|
|
|
|
import { CoreModule } from './core'
|
2020-05-29 14:16:24 +00:00
|
|
|
import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header'
|
2020-06-23 12:49:20 +00:00
|
|
|
import { HighlightPipe } from './header/highlight.pipe'
|
2019-01-08 10:26:41 +00:00
|
|
|
import { AvatarNotificationComponent, LanguageChooserComponent, MenuComponent } from './menu'
|
2020-06-23 12:10:17 +00:00
|
|
|
import { ConfirmComponent } from './modal/confirm.component'
|
|
|
|
import { CustomModalComponent } from './modal/custom-modal.component'
|
|
|
|
import { InstanceConfigWarningModalComponent } from './modal/instance-config-warning-modal.component'
|
|
|
|
import { QuickSettingsModalComponent } from './modal/quick-settings-modal.component'
|
|
|
|
import { WelcomeModalComponent } from './modal/welcome-modal.component'
|
|
|
|
import { SharedFormModule } from './shared/shared-forms'
|
|
|
|
import { SharedGlobalIconModule } from './shared/shared-icons'
|
|
|
|
import { SharedInstanceModule } from './shared/shared-instance'
|
|
|
|
import { SharedMainModule } from './shared/shared-main'
|
|
|
|
import { SharedUserInterfaceSettingsModule } from './shared/shared-user-settings'
|
2020-05-29 14:39:49 +00:00
|
|
|
|
|
|
|
registerLocaleData(localeOc, 'oc')
|
2016-11-20 16:18:15 +00:00
|
|
|
|
2016-09-06 20:40:57 +00:00
|
|
|
@NgModule({
|
|
|
|
bootstrap: [ AppComponent ],
|
2020-06-23 12:10:17 +00:00
|
|
|
|
2016-09-06 20:40:57 +00:00
|
|
|
declarations: [
|
2017-12-01 08:20:19 +00:00
|
|
|
AppComponent,
|
|
|
|
|
|
|
|
MenuComponent,
|
2018-06-28 11:59:48 +00:00
|
|
|
LanguageChooserComponent,
|
2020-02-28 12:52:21 +00:00
|
|
|
QuickSettingsModalComponent,
|
2019-01-08 10:26:41 +00:00
|
|
|
AvatarNotificationComponent,
|
2019-08-28 12:40:06 +00:00
|
|
|
HeaderComponent,
|
2020-01-20 14:12:51 +00:00
|
|
|
SearchTypeaheadComponent,
|
2020-01-25 15:32:06 +00:00
|
|
|
SuggestionComponent,
|
2020-06-23 12:49:20 +00:00
|
|
|
HighlightPipe,
|
2019-08-28 12:40:06 +00:00
|
|
|
|
2020-04-15 13:35:41 +00:00
|
|
|
CustomModalComponent,
|
2019-08-28 12:40:06 +00:00
|
|
|
WelcomeModalComponent,
|
2020-06-23 12:10:17 +00:00
|
|
|
InstanceConfigWarningModalComponent,
|
|
|
|
ConfirmComponent
|
2016-09-06 20:40:57 +00:00
|
|
|
],
|
2020-06-23 12:10:17 +00:00
|
|
|
|
2016-11-20 16:18:15 +00:00
|
|
|
imports: [
|
2016-09-06 20:40:57 +00:00
|
|
|
BrowserModule,
|
2016-09-09 20:23:41 +00:00
|
|
|
|
2016-11-20 16:18:15 +00:00
|
|
|
CoreModule,
|
2020-06-23 12:10:17 +00:00
|
|
|
SharedMainModule,
|
|
|
|
SharedFormModule,
|
|
|
|
SharedUserInterfaceSettingsModule,
|
|
|
|
SharedGlobalIconModule,
|
|
|
|
SharedInstanceModule,
|
2016-11-20 16:18:15 +00:00
|
|
|
|
2017-03-12 17:40:05 +00:00
|
|
|
MetaModule.forRoot({
|
|
|
|
provide: MetaLoader,
|
2020-05-11 11:39:06 +00:00
|
|
|
useFactory: (serverService: ServerService) => {
|
|
|
|
return new MetaStaticLoader({
|
|
|
|
pageTitlePositioning: PageTitlePositioning.PrependPageTitle,
|
|
|
|
pageTitleSeparator: ' - ',
|
|
|
|
get applicationName () { return serverService.getTmpConfig().instance.name },
|
|
|
|
defaults: {
|
|
|
|
get title () { return serverService.getTmpConfig().instance.name },
|
|
|
|
get description () { return serverService.getTmpConfig().instance.shortDescription }
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
2018-03-22 13:13:30 +00:00
|
|
|
deps: [ ServerService ]
|
2018-05-31 09:35:01 +00:00
|
|
|
}),
|
|
|
|
|
2018-05-31 12:43:48 +00:00
|
|
|
AppRoutingModule // Put it after all the module because it has the 404 route
|
2016-09-06 20:40:57 +00:00
|
|
|
],
|
2020-02-07 14:51:19 +00:00
|
|
|
|
2018-05-31 16:12:15 +00:00
|
|
|
providers: [
|
2020-02-12 10:34:34 +00:00
|
|
|
{
|
|
|
|
provide: APP_BASE_HREF,
|
|
|
|
useValue: '/'
|
|
|
|
},
|
|
|
|
|
2018-05-31 16:12:15 +00:00
|
|
|
{
|
|
|
|
provide: TRANSLATIONS,
|
2018-10-18 07:08:59 +00:00
|
|
|
useFactory: (locale: string) => {
|
2020-04-03 12:55:16 +00:00
|
|
|
// Default locale, nothing to translate
|
2018-06-06 15:37:13 +00:00
|
|
|
const completeLocale = getCompleteLocale(locale)
|
|
|
|
if (isDefaultLocale(completeLocale)) return ''
|
2018-05-31 16:12:15 +00:00
|
|
|
|
2018-06-06 15:37:13 +00:00
|
|
|
const fileLocale = buildFileLocale(locale)
|
2020-04-03 12:55:16 +00:00
|
|
|
return require(`raw-loader!../locale/angular.${fileLocale}.xlf`).default
|
2018-05-31 16:12:15 +00:00
|
|
|
},
|
|
|
|
deps: [ LOCALE_ID ]
|
|
|
|
},
|
|
|
|
{ provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }
|
|
|
|
]
|
2016-09-06 20:40:57 +00:00
|
|
|
})
|
2017-12-11 16:36:46 +00:00
|
|
|
export class AppModule {}
|