Skip to content

feat(tui): add per-locale i18n infrastructure and wire UI strings - #52000

Closed
imyu37 wants to merge 11 commits into
anomalyco:devfrom
imyu37:feat/tui-i18n
Closed

imyu37 wants to merge 11 commits into
anomalyco:devfrom
imyu37:feat/tui-i18n

Conversation

@imyu37

@imyu37 imyu37 commented Sep 29, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #37216

Tracking notes: #53857 (opened for this PR's issue-first link) was triaged by the repo bot as a duplicate of #37216 and is being closed as such; #51998 was auto-closed by the issue-compliance workflow before its body could be converted to the template structure. Both preserved for history.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adapts the TUI i18n groundwork from #48731 (by @neriousy, original commits preserved via merge) onto the current v2 branch, where it had fallen ~550 commits behind.

  • i18n infrastructure in packages/tui: lazy per-locale dictionaries for 62 locales, language.t() / plural() / number() / duration() / date() helpers, useLanguage context, a language picker, and config.language support. No behavior change when no locale is configured (English default).
  • Wiring: ~100+ components and feature plugins (dialogs, composer, session route, sidebar, diff-viewer, stats, toasts, notifications, …) now read user-facing strings through language.t(...) instead of hardcoded English.
  • Conflict resolution against v2: kept v2's evolved APIs (theme tokens, surface(), dialog patterns, props.sources diff sources, fail/attempt helpers) and re-applied the PR's language.t(...) wiring on top; dropped PR-side features whose APIs v2 has since removed.
  • Synced with current v2 again (merge commit, 216c311744): upstream meanwhile moved GUI features into built-in extensions; 10 tsx files conflicted (dialogs, session tabs, sidebar, subagents tab, …) and were resolved by keeping upstream's structural changes (new StringChoiceField, external connection flow, recently-closed-tabs menu, filter.active rename, removed server?/overlay? props and the unshare command) and re-wrapping their new user-facing strings: ~25 language.t(...) call sites re-applied, +6 keys (tui.details.submitAnswer/backToAnswers/editAnswerHint/selectAnswerHint, tui.dialogs.recentlyClosedTabs/noRecentlyClosedTabs — zh/zht translated, other locales English placeholder), −1 orphan key (tui.session.unshareSession, UI removed upstream).
  • 7 new keys (tui.diff.turn*, tui.verbosity, tui.tabs.mode, tui.dialogs.pairHint, tui.dialogs.updating) added to en.ts and all 62 locale files; zh/zht carry real translations, other locales carry the English source string as placeholder — same convention as the rest of the PR.

How did you verify your code works?

  • oxlint packages/tui/src packages/tui/test → 0 warnings, 0 errors (523 files)
  • tsgo -b in packages/tui → exit 0
  • After the v2 sync: bun test in packages/tui → 1504 pass / 12 skip / 11 fail; the failure set is baseline Windows-environment failures (symlink EPERM, atomic-rename file locks, footer rendering) including two new test files upstream added that hit the same symlink/rename limits — no logic regressions; tests touched by the conflict resolution pass in isolation
  • After the v2 sync: tsgo -b in packages/tui → exit 0; prettier --check on all changed files → clean; test/i18n.test.ts → 64 pass (all locales cover the en key set with matching placeholders)
  • bun run test:unit in packages/app → 930 pass / 0 fail (i18n parity tests included)
  • locale key check (verifykeys.js) → ok: 63, bad: none
  • repo-wide grep for conflict markers → none

Screenshots / recordings

Terminal UI change: default English output is visually unchanged; the one new visual element is the language picker dialog (unchanged from #48731). Can record a short demo on request.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@imyu37 imyu37 mentioned this pull request Sep 29, 2026
6 tasks
Resolve 10 packages/tui conflicts by keeping upstream's refactors and re-applying the branch's i18n wiring (t() calls, dictionary keys, imports). Add new en/zh/zht catalog entries and backfill all locales; drop unused upstream imports and normalize formatting.
imyu37 added 2 commits October 8, 2026 22:49
# Conflicts:
#	packages/tui/src/app.tsx
# Conflicts:
#	packages/tui/src/routes/session/message-parts.tsx
@thdxr
thdxr changed the base branch from v2 to dev October 10, 2026 19:22
@imyu37

imyu37 commented Oct 14, 2026

Copy link
Copy Markdown
Author

Mergeability note — local verification shows no conflict

This branch was synced with the latest v2 (4617210822) and GitHub reports dirty, but local verification shows no conflict:

Local merge-tree preview (non-destructive):

git merge-tree --write-tree --name-only HEAD origin/v2
# exit: 0 — no conflict files

What the 4 new v2 commits touch:

  • chore(core): refresh bundled models.dev snapshot
  • chore(ci): build desktop from the unsigned CLI artifact
  • chore: update nix node_modules hashes
  • chore: upgrade Effect to 4.0.1

None of these touch packages/tui/, so they don't overlap with this PR's i18n wiring.

Verification on the current HEAD (f0df35b44d):

  • bun run typecheck in packages/tui → exit 0
  • bun x prettier --check → clean
  • bun run test → 1513 pass / 7 fail (all in known Windows baseline)
  • Conflict markers → 0

The PR is ready to merge from a content perspective. If there's a specific merge requirement or if GitHub's mergeability check needs a nudge, please let me know.

This was referenced Oct 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: i18n support for TUI (terminal interface)

1 participant