Skip to content

Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.

fix(i18n): guard template name lookups with t.has() to prevent MISSING_MESSAGE crash (#425)

Maqbool Ahmedf53a2f77d159
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/reports/[id]/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/reports/[id]/page.tsx
index 5b0bdffe7..ac9e931e0 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/reports/[id]/page.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/reports/[id]/page.tsx
@@ -171,9 +171,10 @@ export default function ReportDetailPage() {
</Link>
<h1 className="text-2xl font-bold tracking-tight">{report.title}</h1>
<p className="text-sm text-muted-foreground">
- {KNOWN_TEMPLATE_IDS.has(report.template) && (
- <>{t(`templates.${report.template}.name`)} · </>
- )}
+ {KNOWN_TEMPLATE_IDS.has(report.template) &&
+ t.has(`templates.${report.template}.name`) && (
+ <>{t(`templates.${report.template}.name`)} · </>
+ )}
{formatDate(report.dateFrom)} — {formatDate(report.dateTo)} · {t('generatedOn')}{' '}
{formatDate(report.createdAt)}
</p>
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/reports/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/reports/page.tsx
index 6db3b7350..11daa825e 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/reports/page.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/reports/page.tsx
@@ -230,11 +230,12 @@ export default function ReportsPage() {
<TableRow key={report.id}>
<TableCell>
<span className="font-medium">{report.title}</span>
- {KNOWN_TEMPLATE_IDS.has(report.template) && (
- <span className="mt-0.5 block text-xs text-muted-foreground">
- {t(`templates.${report.template}.name`)}
- </span>
- )}
+ {KNOWN_TEMPLATE_IDS.has(report.template) &&
+ t.has(`templates.${report.template}.name`) && (
+ <span className="mt-0.5 block text-xs text-muted-foreground">
+ {t(`templates.${report.template}.name`)}
+ </span>
+ )}
</TableCell>
<TableCell className="text-muted-foreground">
{formatDate(report.dateFrom)} — {formatDate(report.dateTo)}
@@ -299,13 +300,16 @@ export default function ReportsPage() {
)}
>
<div className="flex items-center justify-between gap-2">
- <span className="text-sm font-medium">{t(`templates.${tpl.id}.name`)}</span>
+ <span className="text-sm font-medium">
+ {t.has(`templates.${tpl.id}.name`) ? t(`templates.${tpl.id}.name`) : tpl.id}
+ </span>
<span className="shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground">
{t(`presets.${tpl.defaultPreset}`)}
</span>
</div>
<p className="mt-1 text-xs text-muted-foreground">
- {t(`templates.${tpl.id}.description`)}
+ {t.has(`templates.${tpl.id}.description`) &&
+ t(`templates.${tpl.id}.description`)}
</p>
<div className="mt-2 flex flex-wrap gap-1">
{tpl.sections.map((s) => (