|
|
@ -1,4 +1,4 @@ |
|
|
import { Injectable, Optional, SkipSelf } from '@angular/core'; |
|
|
import { Injectable, Optional, SkipSelf, NgZone } from '@angular/core'; |
|
|
import { ActivatedRouteSnapshot, Router } from '@angular/router'; |
|
|
import { ActivatedRouteSnapshot, Router } from '@angular/router'; |
|
|
import { Actions, Store } from '@ngxs/store'; |
|
|
import { Actions, Store } from '@ngxs/store'; |
|
|
import { noop, Observable } from 'rxjs'; |
|
|
import { noop, Observable } from 'rxjs'; |
|
|
@ -17,6 +17,7 @@ export class LocalizationService { |
|
|
constructor( |
|
|
constructor( |
|
|
private store: Store, |
|
|
private store: Store, |
|
|
private router: Router, |
|
|
private router: Router, |
|
|
|
|
|
private ngZone: NgZone, |
|
|
private actions: Actions, |
|
|
private actions: Actions, |
|
|
@Optional() |
|
|
@Optional() |
|
|
@SkipSelf() |
|
|
@SkipSelf() |
|
|
@ -35,9 +36,11 @@ export class LocalizationService { |
|
|
this.setRouteReuse(() => false); |
|
|
this.setRouteReuse(() => false); |
|
|
this.router.navigated = false; |
|
|
this.router.navigated = false; |
|
|
|
|
|
|
|
|
return registerLocale(locale).then(async () => { |
|
|
return registerLocale(locale).then(() => { |
|
|
await this.router.navigateByUrl(this.router.url).catch(noop); |
|
|
this.ngZone.run(async () => { |
|
|
this.setRouteReuse(shouldReuseRoute); |
|
|
await this.router.navigateByUrl(this.router.url).catch(noop); |
|
|
|
|
|
this.setRouteReuse(shouldReuseRoute); |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|