Skip to content

Commit

Permalink
fix page title after i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
bearn01d committed Oct 24, 2024
1 parent 7bd3648 commit 2a5e5c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ the detailed section referring to by linking pull requests or issues.

#### Patch

- Fix broken title after i18n
([#844](https://github.com/sovity/edc-ui/issues/844))

### Deployment Migration Notes

_No special deployment migration steps required_
Expand Down
8 changes: 4 additions & 4 deletions src/app/core/services/page-title-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
RouterStateSnapshot,
TitleStrategy,
} from '@angular/router';
import {Subject, switchMap} from 'rxjs';
import {Subject} from 'rxjs';
import {TranslateService} from '@ngx-translate/core';

@Injectable()
Expand All @@ -17,9 +17,9 @@ export class CustomPageTitleStrategy extends TitleStrategy {
private title: Title,
) {
super();
this.rawTitle$
.pipe(switchMap((title) => this.translateService.get(title)))
.subscribe((title) => this.title.setTitle(title));
this.rawTitle$.subscribe((title) =>
this.title.setTitle(this.translateService.instant(title)),
);
}

override updateTitle(snapshot: RouterStateSnapshot): void {
Expand Down

0 comments on commit 2a5e5c2

Please sign in to comment.