Skip to content

Batch 7: English / Romanian switch - #7

Open
Arvi23 wants to merge 1 commit into
batch-6-peersfrom
batch-7-language
Open

Arvi23 wants to merge 1 commit into
batch-6-peersfrom
batch-7-language

Conversation

@Arvi23

@Arvi23 Arvi23 commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Stacked on #6.

English / Romanian (D15)

  • Switch: EN/RO in the home top bar and in Settings. The choice is a ws_lang cookie, and switching reloads the page.
  • Frontend:
    • static/js/i18n.js holds a dictionary keyed by the English text.
    • Static and dynamically inserted text is translated automatically by a MutationObserver; strings with variables use t().
    • News, LLM output and chat are excluded (no-i18n).
    • Numbers, money and dates are locale-aware.
  • Backend:
    • watchstock/i18n.py (tr, num), with a middleware that sets the request language.
    • Localised: score breakdowns, labels and flags, "Your stocks" events (with Romanian dates), portfolio flags, warnings and errors.
    • Scores are computed at serve time, so switching language applies to cached data too.
    • The LLM writes reports, thesis checks and chat in Romanian.
  • Tests:
    • tests/test_i18n.py fails if any string is missing a translation.
    • The UI smoke test audits Romanian pages for leftover English.

109 backend tests.


Generated by Claude Code

- EN/RO switch in the home top bar and in Settings; the choice is a ws_lang
  cookie, so it's known at page load and sent with every request (D15).
- Frontend: static/js/i18n.js with a Romanian dictionary keyed by the English
  text (~300 strings). Static and dynamically inserted text is translated
  automatically by a MutationObserver; strings with variables use t(). News,
  LLM output and chat are marked no-i18n. Numbers, money and dates are
  locale-aware (fmtN, Intl with ro-RO).
- Backend: watchstock/i18n.py (tr, num) and a middleware that sets the
  request language. Score breakdowns, labels and flags, Today events (with
  Romanian dates), portfolio flags, warnings and errors are localised.
  Scores are now computed at serve time, so a language switch applies to
  cached snapshots. The LLM is told to write in Romanian.
- tests/test_i18n.py enforces complete dictionaries (backend tr() literals,
  frontend t() calls, every string in index.html) and matching placeholders.
  The UI smoke test audits Romanian pages for leftover English. It caught a
  MutationObserver infinite loop on identical translations ("P/E") and the
  logo turning into "WatchAcțiune".
- CLAUDE.md: translation rules for future changes.

109 backend tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TW7cJeWrcBW5SJHr4ZKtSH
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.

1 participant