Skip to content

i18n: wire the Insights page to next-intl - #518

Merged
gkhngyk merged 2 commits into
ansvisor:mainfrom
d180:fix/insights-page-i18n
Jul 25, 2026
Merged

gkhngyk merged 2 commits into
ansvisor:mainfrom
d180:fix/insights-page-i18n

Conversation

@d180

@d180 d180 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

The Insights page (web/src/app/[locale]/(dashboard)/dashboard/insights/page.tsx) never wired the insights next-intl namespace that already exists in en.json (~14 keys), despite the page rendering hardcoded English. This wires the keys that actually correspond to live text on the page today: title (already partially wired), runPrompts (the empty-state "Run Prompts Now" button), mentions and citations (KPI card titles), positive + sentiment composed together (the "Positive Sentiment" KPI card title), and platform (the "Share of Voice by Platform" card title). The remaining keys (description, promptResults, score, neutral, negative) don't match any text currently rendered on this page — per the issue's scope note, adding new keys for uncovered text is a follow-up, not part of this PR. No behavior change; English renders identically to today.

Related issue

Closes #439

Type of change

  • fix — Bug fix

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mentions / citations wirings are exactly right, and the narrow scope is fine — #439 explicitly says keys that don't match live text are a follow-up. But three of the wirings compose translated fragments with hardcoded English, which breaks the moment a real locale lands:

  1. {t('runPrompts')} Now — renders half-translated (" Now").
  2. ${t('positive')} ${t('sentiment')} — positive/neutral/negative are sentiment value labels; word-by-word composition doesn't survive other languages' word order.
  3. Share of Voice by {t('platform')} — same hardcoded-prefix + translated-suffix hybrid.

These look wired but would ship half-English sentences to any future locale — worse than staying hardcoded, because a translator will assume they're done.

Either is fine with me:

  • (a) Leave those three strings hardcoded — the existing keys don't actually match them, and #439 scopes unmatched text as follow-up; or
  • (b) Add three proper keys (runPromptsNow, positiveSentiment, sovByPlatform) and wire them whole — a three-line addition that stays within scope.

Happy to re-review right away.

@d180

d180 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@gkhngyk Please review it now.

@d180
d180 requested a review from gkhngyk July 23, 2026 21:26
@gkhngyk

gkhngyk commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

The three composed strings are exactly right now — thanks! One last step: the branch conflicts with just-merged #512 in insights/page.tsx (same KpiCard block). Please rebase onto main and, when resolving, keep main's new tooltip sentence ("Percentage of answers that mention your brand and describe it in a positive context.") — your branch still carries the old wording. Happy to approve right after the rebase.

@d180
d180 force-pushed the fix/insights-page-i18n branch from 6d3d421 to df21e60 Compare July 25, 2026 06:23
@d180

d180 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@gkhngyk Rebased onto main — conflict in insights/page.tsx resolved by keeping main's new tooltip wording from #512 while wiring the title through t('positiveSentiment'). Ready for re-review.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased cleanly with the #512 tooltip wording kept, and all three composed strings are now proper whole-sentence keys. Thanks for sticking with this through both rounds — the Insights page i18n is a solid improvement!

@gkhngyk
gkhngyk merged commit 9544725 into ansvisor:main Jul 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

i18n: wire the Insights page to next-intl

2 participants