Skip to content

fix: i18n for remaining hardcoded strings - #140

Merged
NoviUIKI merged 1 commit into
devfrom
feat/i18n-completion
Aug 19, 2026
Merged

NoviUIKI merged 1 commit into
devfrom
feat/i18n-completion

Conversation

@BerryUIKI

@BerryUIKI BerryUIKI commented Aug 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

Complete i18n for the remaining hardcoded strings (tasks #4 #7).

Changes

  • Locale catalog: added typed zh/en keys (dashboard, performance, agent panel/config, options filters, research dialogs, artifacts)
  • TodayPage / OverviewTab / PerformanceTab / ActivityTab: all copy moved to t(), thesis count uses formatMessage
  • AgentPanel / AgentConfigGuide: i18n-ized and removed (t as any) fallbacks
  • GreeksCalculator / OptionContractTable: i18n-ized (filter tabs, column headers, delete confirmation)
  • CreateResearchProjectDialog / CreateAccountDialog: i18n-ized; errors keep err.message
  • Tests: dashboard/performance tests wrapped in an en LocaleContext provider

This PR must merge first (the error/artifacts/splits PRs depend on locale keys added here).

…logs)

- Add typed zh/en keys to locale catalog for dashboard, performance,
  agent panel/config, options filters, research dialogs, and artifacts
- i18n TodayPage/OverviewTab/PerformanceTab/ActivityTab
- i18n AgentPanel and AgentConfigGuide (remove (t as any) fallbacks)
- i18n GreeksCalculator, OptionContractTable, CreateResearchProjectDialog,
  CreateAccountDialog
- Wrap dashboard/performance tests with en LocaleContext provider

@NoviUIKI NoviUIKI left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review summary — PR #140

Verdict: ✅ Approve

Clean, well-typed i18n refactor. I verified the diff, ran the typecheck, and executed the affected tests.

Critical

  • None.

Important

  • None.

Suggestions (non-blocking)

  1. getSampleMessages(t) re-allocates on every render (AgentPanel.tsx:132). The list was previously a module-level constant; each render now rebuilds it. Negligible at 3 items, but worth memoizing if the panel grows.
  2. OverviewTab.tsx mixes t with the lower-level translate/formatMessage APIs and a manual !== 1 singular/plural branch. It works for zh/en, but it diverges from the standard t usage elsewhere in this PR and won't generalize to locales with richer plural rules. A small plural helper would keep it uniform.
  3. Scope note: the PR also bundles a small behavior change (option-contract delete now surfaces an error banner) and pre-adds artifact-delete keys that a later PR in this stack (#142) actually consumes. Harmless, just slightly beyond "i18n".

Strengths

  • Removes the (t("...") as any) || "fallback" pattern in favor of fully typed MessageKey keys. Since MessageKey is the intersection of the zh/en catalogs, a missing key can't even compile.
  • Adds htmlFor/id label associations in GreeksCalculator — an accessibility win.
  • Wraps the dashboard tests in a LocaleContext.Provider, so they render deterministically (and no longer crash on t).
  • CreateResearchProjectDialog validation errors are now localized and the generic failure message is only used when the error carries no message.

Verification

  • tsc --noEmit (apps/desktop): passes.
  • vitest on PerformanceTab.test.tsx + dashboard-tabs.test.tsx: 12/12 pass.
  • git diff --check: clean.

@NoviUIKI
NoviUIKI merged commit 04327b3 into dev Aug 19, 2026
5 checks passed
@BerryUIKI
BerryUIKI deleted the feat/i18n-completion branch August 20, 2026 06:39
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.

2 participants