aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/main.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/main.ts')
-rw-r--r--client/src/main.ts28
1 files changed, 7 insertions, 21 deletions
diff --git a/client/src/main.ts b/client/src/main.ts
index 2b65072ad..3fb9b346e 100644
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -1,31 +1,17 @@
1import { enableProdMode, TRANSLATIONS, TRANSLATIONS_FORMAT } from '@angular/core' 1import { enableProdMode } from '@angular/core'
2import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' 2import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
3 3
4import { AppModule } from './app/app.module' 4import { AppModule } from './app/app.module'
5import { environment } from './environments/environment' 5import { environment } from './environments/environment'
6 6
7import { hmrBootstrap } from './hmr' 7import { hmrBootstrap } from './hmr'
8import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils'
9import { buildFileLocale } from '../../shared'
10 8
11let providers: any[] = []
12if (environment.production) { 9if (environment.production) {
13 enableProdMode() 10 enableProdMode()
14} 11}
15 12
16// Template translation, should be in the bootstrap step
17if (isOnDevLocale()) {
18 const locale = buildFileLocale(getDevLocale())
19 const translations = require(`raw-loader!./locale/angular.${locale}.xlf`)
20
21 providers = [
22 { provide: TRANSLATIONS, useValue: translations },
23 { provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }
24 ]
25}
26
27const bootstrap = () => platformBrowserDynamic() 13const bootstrap = () => platformBrowserDynamic()
28 .bootstrapModule(AppModule, { providers }) 14 .bootstrapModule(AppModule)
29 .then(bootstrapModule => { 15 .then(bootstrapModule => {
30 // TODO: Uncomment and remove unregistration when https://github.com/angular/angular/issues/21191 is fixed 16 // TODO: Uncomment and remove unregistration when https://github.com/angular/angular/issues/21191 is fixed
31 // TODO: Remove when https://github.com/angular/angular-cli/issues/8779 is fixed? 17 // TODO: Remove when https://github.com/angular/angular-cli/issues/8779 is fixed?
@@ -36,11 +22,11 @@ const bootstrap = () => platformBrowserDynamic()
36 22
37 if (navigator.serviceWorker && typeof navigator.serviceWorker.getRegistrations === 'function') { 23 if (navigator.serviceWorker && typeof navigator.serviceWorker.getRegistrations === 'function') {
38 navigator.serviceWorker.getRegistrations() 24 navigator.serviceWorker.getRegistrations()
39 .then(registrations => { 25 .then(registrations => {
40 for (const registration of registrations) { 26 for (const registration of registrations) {
41 registration.unregister() 27 registration.unregister()
42 } 28 }
43 }) 29 })
44 } 30 }
45 31
46 return bootstrapModule 32 return bootstrapModule