fix: browser tab title showing raw translation keys (labels.text.*)
The title resolver now tries labels.text.*, then labels.menus.*, then falls back to the raw route title — matching the breadcrumb logic. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
7b1f2e8ad7
commit
6ed020907a
@@ -187,13 +187,22 @@ export class WebAppComponent implements OnInit, OnDestroy {
|
|||||||
takeUntil(this.destroy$)
|
takeUntil(this.destroy$)
|
||||||
)
|
)
|
||||||
.subscribe((event) => {
|
.subscribe((event) => {
|
||||||
const title = event['title'] ? `labels.text.${event['title']}` : 'APP_NAME';
|
if (!event['title']) {
|
||||||
this.i18nService
|
this.i18nService.translate('APP_NAME').pipe(take(1)).subscribe((t: any) => this.titleService.setTitle(t));
|
||||||
.translate(title)
|
return;
|
||||||
.pipe(take(1))
|
}
|
||||||
.subscribe((titleTranslated: any) => {
|
const raw = event['title'];
|
||||||
this.titleService.setTitle(titleTranslated);
|
const textKey = `labels.text.${raw}`;
|
||||||
});
|
const menuKey = `labels.menus.${raw}`;
|
||||||
|
this.i18nService.translate(textKey).pipe(take(1)).subscribe((textResult: any) => {
|
||||||
|
if (textResult !== textKey) {
|
||||||
|
this.titleService.setTitle(textResult);
|
||||||
|
} else {
|
||||||
|
this.i18nService.translate(menuKey).pipe(take(1)).subscribe((menuResult: any) => {
|
||||||
|
this.titleService.setTitle(menuResult !== menuKey ? menuResult : raw);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Stores top 100 user activites as local storage object.
|
// Stores top 100 user activites as local storage object.
|
||||||
|
|||||||
Reference in New Issue
Block a user