update user guide when language changes.

This commit is contained in:
Bernaldo Mihasi 2023-05-02 12:56:09 +03:00
parent 50169222c7
commit 7c347569fd
1 changed files with 8 additions and 1 deletions

View File

@ -1,11 +1,13 @@
import { HttpClient } from '@angular/common/http';
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
import { Router } from '@angular/router';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { LanguageService } from '@app/core/services/language/language.service';
import { MatomoService } from '@app/core/services/matomo/matomo-service';
import { UserGuideService } from '@app/core/services/user-guide/user-guide.service';
import { BaseComponent } from '@common/base/base.component';
import { LangChangeEvent, TranslateService } from '@ngx-translate/core';
import { interval, Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@ -33,7 +35,9 @@ export class UserGuideContentComponent extends BaseComponent implements OnInit {
private languageService: LanguageService,
private httpClient: HttpClient,
private matomoService: MatomoService,
private configurationService: ConfigurationService
private configurationService: ConfigurationService,
private translate: TranslateService,
private router: Router
) { super(); }
ngOnInit() {
@ -43,6 +47,9 @@ export class UserGuideContentComponent extends BaseComponent implements OnInit {
this.activeToc(ev);
this.scroll(ev);
});
this.translate.onLangChange.subscribe((event: LangChangeEvent) => {
this.router.navigate(['/reload']).then(() => this.router.navigate(['/user-guide']));
});
this.userGuideService.getUserGuide(this.languageService.getCurrentLanguage())
.pipe(takeUntil(this._destroyed))
.subscribe(response => {