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:
Aditya
2026-03-20 22:21:13 +05:30
co-authored by Claude Opus 4.6
parent 7b1f2e8ad7
commit 6ed020907a
+16 -7
View File
@@ -187,13 +187,22 @@ export class WebAppComponent implements OnInit, OnDestroy {
takeUntil(this.destroy$)
)
.subscribe((event) => {
const title = event['title'] ? `labels.text.${event['title']}` : 'APP_NAME';
this.i18nService
.translate(title)
.pipe(take(1))
.subscribe((titleTranslated: any) => {
this.titleService.setTitle(titleTranslated);
});
if (!event['title']) {
this.i18nService.translate('APP_NAME').pipe(take(1)).subscribe((t: any) => this.titleService.setTitle(t));
return;
}
const raw = event['title'];
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.