Skip to content

I18n common markstream keys#1553

Merged
zerob13 merged 2 commits intodevfrom
i18n-common-markstream-keys
Apr 28, 2026
Merged

I18n common markstream keys#1553
zerob13 merged 2 commits intodevfrom
i18n-common-markstream-keys

Conversation

@zhangmo8
Copy link
Copy Markdown
Collaborator

@zhangmo8 zhangmo8 commented Apr 28, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved error messaging specificity for provider import and API key operations.
  • New Features

    • Added localized support for image loading states, preview labels, and error messages across 12+ languages.
    • Extended UI controls for zoom adjustment, font sizing, and content navigation.
    • Introduced privacy mode settings with localized descriptions and provider-specific options.
  • Documentation

    • Updated type definitions to reflect new localization keys.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

📝 Walkthrough

Walkthrough

This pull request adds process launch signature computation for warmup and inflight process reuse gating, extends internationalization support with new UI control labels across all locales, creates new image translation namespaces, updates related type definitions, and refines error toast messaging in settings components.

Changes

Cohort / File(s) Summary
Process Manager Launch Signature
src/main/presenter/llmProviderPresenter/acp/acpProcessManager.ts
Added launchSignature field to AcpProcessHandle computed from resolved launch spec properties (command/args/env/cwd/distributionType/version/installDir); warmup and inflight process reuse now gates on matching signatures instead of indiscriminate reuse.
Settings UI Error Messages
src/renderer/settings/App.vue, src/renderer/settings/components/McpBuiltinMarket.vue
Updated error toast titles from generic common.error to more specific common.error.operationFailed for provider import and API key save operations.
Common i18n Keys (All Locales)
src/renderer/src/i18n/*/common.json (da-DK, en-US, fa-IR, fr-FR, he-IL, ja-JP, ko-KR, pt-BR, ru-RU, zh-CN, zh-HK, zh-TW)
Added 12 new translation keys per locale for UI controls: noContent, preview, source, more, decrease, increase, fontSmaller, fontReset, fontLarger, zoomIn, zoomOut, resetZoom.
Image i18n Namespace (All Locales)
src/renderer/src/i18n/*/image.json (da-DK, en-US, fa-IR, fr-FR, he-IL, ja-JP, ko-KR, pt-BR, ru-RU, zh-CN, zh-HK, zh-TW)
Created new image.json files for all locales containing 3 keys each: loadError, loading, preview for image-related UI messaging.
Locale Index Files
src/renderer/src/i18n/*/index.ts (da-DK, en-US, fa-IR, fr-FR, he-IL, ja-JP, ko-KR, pt-BR, ru-RU, zh-CN, zh-HK, zh-TW)
Updated all locale indices to import new image.json and expose it as top-level image property in exported i18n bundle.
i18n Type Definitions
src/types/i18n.d.ts
Extended DefineLocaleMessage interface with new UI control keys, image-related keys, Moonshot Kimi temperature label, and full privacy mode feature key set (privacyMode, privacyModeDescription, privacyModeAutoUpdate, privacyModeProviderDb, privacyModeAcpRegistry, privacyModeNpmRegistry, privacyModeManualActions, privacyModeIntegrations).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • PR #960: Adds/updates pt-BR translation files and integrates them into i18n index structure.
  • PR #1507: Introduces Moonshot Kimi temperature localization keys and updates locale type declarations.

Suggested labels

codex

Poem

🐰 Hoppity through the locales we go,
Image keys budding in every locale's row,
Signatures guard the warmup with care,
Error toasts refined everywhere,
A global embrace in a hundred tongue singsong! 🌍✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'I18n common markstream keys' is vague and non-descriptive, using generic terminology that doesn't clearly convey what changes are being made. It fails to explain the primary purpose of the changeset (adding UI control translations, error handling improvements, process management changes). Revise the title to be more specific and descriptive, such as 'Add i18n translations for UI controls, image handling, and process management' or 'Extend i18n localization with common UI and image keys across all locales'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch i18n-common-markstream-keys

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
src/renderer/settings/components/McpBuiltinMarket.vue (1)

190-208: Consider sanitizing error text in user-facing toast.

The description: String(e) can surface internal/server details to end-users. Consider logging the raw error to console (or a logger) and showing a stable, user-safe message instead.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/settings/components/McpBuiltinMarket.vue` around lines 190 -
208, In saveApiKey, avoid exposing raw error text to users: catch the error, log
the full error object via console.error or a logger (e.g., include the error
from the catch), then pass a stable, user-safe message into the toast
description (e.g., a generic 'Unable to save API key' or localized t(...)
string) while retaining the destructive variant; keep calls to
mcpP.setMcpRouterApiKey and mcpP.updateMcpRouterServersAuth unchanged but ensure
their thrown errors are what you log, not displayed to the user.
src/renderer/settings/App.vue (1)

423-427: User-facing description is still raw error text (optional).

This PR changes the toast title to an i18n key, but the toast description is still error.message / String(error). If you expect structured error codes, consider mapping them to localized i18n keys so the description is also user-friendly in all languages (optional, since this change might be intentionally scoped to the title).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/settings/App.vue` around lines 423 - 427, The toast currently
shows raw error text in the description (toast(...) using description: error
instanceof Error ? error.message : String(error)); change this to map errors to
localized messages by creating or using a mapping helper (e.g.,
mapErrorToI18nKey or mapErrorToMessage) and call t(...) for the description
instead of raw error.message; update the toast invocation in App.vue to pass
t(mapErrorToI18nKey(error)) with a sensible fallback like
t('common.error.operationFailedDetails') so users see a translated, friendly
message across locales.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/presenter/llmProviderPresenter/acp/acpProcessManager.ts`:
- Around line 106-115: The current createLaunchSignature produces a signature
from the resolved launch spec but misses downstream modifications applied in
spawnAgentProcess (like agentState?.envOverride, npm/uv registry overrides,
runtime command expansion/replacement, and cwd fallback) and suffers from env
key order variance; update createLaunchSignature (and the other occurrences of
the same logic) to accept or compute the final spawn inputs used by
spawnAgentProcess (final command and args after expansion, merged env including
agentState?.envOverride and registry overrides, and the effective cwd with
fallback), normalize the env by sorting its keys deterministically before
serialization, and then JSON.stringify the normalized {command, args, env, cwd,
distributionType, version, installDir} so warmupProcess reuses only truly
equivalent spawn inputs.

In `@src/renderer/src/i18n/zh-HK/common.json`:
- Line 76: The zh-HK translation for the JSON key "source" is using "源碼" (which
means source code); update the value for the "source" key in the zh-HK
common.json to the correct UI wording "來源" to reflect citation/origin meaning
instead of code-related meaning.

---

Nitpick comments:
In `@src/renderer/settings/App.vue`:
- Around line 423-427: The toast currently shows raw error text in the
description (toast(...) using description: error instanceof Error ?
error.message : String(error)); change this to map errors to localized messages
by creating or using a mapping helper (e.g., mapErrorToI18nKey or
mapErrorToMessage) and call t(...) for the description instead of raw
error.message; update the toast invocation in App.vue to pass
t(mapErrorToI18nKey(error)) with a sensible fallback like
t('common.error.operationFailedDetails') so users see a translated, friendly
message across locales.

In `@src/renderer/settings/components/McpBuiltinMarket.vue`:
- Around line 190-208: In saveApiKey, avoid exposing raw error text to users:
catch the error, log the full error object via console.error or a logger (e.g.,
include the error from the catch), then pass a stable, user-safe message into
the toast description (e.g., a generic 'Unable to save API key' or localized
t(...) string) while retaining the destructive variant; keep calls to
mcpP.setMcpRouterApiKey and mcpP.updateMcpRouterServersAuth unchanged but ensure
their thrown errors are what you log, not displayed to the user.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ff090ff6-55c2-4a5e-a6f2-cc2fc5b97c9e

📥 Commits

Reviewing files that changed from the base of the PR and between d770406 and 0ad2f30.

📒 Files selected for processing (40)
  • src/main/presenter/llmProviderPresenter/acp/acpProcessManager.ts
  • src/renderer/settings/App.vue
  • src/renderer/settings/components/McpBuiltinMarket.vue
  • src/renderer/src/i18n/da-DK/common.json
  • src/renderer/src/i18n/da-DK/image.json
  • src/renderer/src/i18n/da-DK/index.ts
  • src/renderer/src/i18n/en-US/common.json
  • src/renderer/src/i18n/en-US/image.json
  • src/renderer/src/i18n/en-US/index.ts
  • src/renderer/src/i18n/fa-IR/common.json
  • src/renderer/src/i18n/fa-IR/image.json
  • src/renderer/src/i18n/fa-IR/index.ts
  • src/renderer/src/i18n/fr-FR/common.json
  • src/renderer/src/i18n/fr-FR/image.json
  • src/renderer/src/i18n/fr-FR/index.ts
  • src/renderer/src/i18n/he-IL/common.json
  • src/renderer/src/i18n/he-IL/image.json
  • src/renderer/src/i18n/he-IL/index.ts
  • src/renderer/src/i18n/ja-JP/common.json
  • src/renderer/src/i18n/ja-JP/image.json
  • src/renderer/src/i18n/ja-JP/index.ts
  • src/renderer/src/i18n/ko-KR/common.json
  • src/renderer/src/i18n/ko-KR/image.json
  • src/renderer/src/i18n/ko-KR/index.ts
  • src/renderer/src/i18n/pt-BR/common.json
  • src/renderer/src/i18n/pt-BR/image.json
  • src/renderer/src/i18n/pt-BR/index.ts
  • src/renderer/src/i18n/ru-RU/common.json
  • src/renderer/src/i18n/ru-RU/image.json
  • src/renderer/src/i18n/ru-RU/index.ts
  • src/renderer/src/i18n/zh-CN/common.json
  • src/renderer/src/i18n/zh-CN/image.json
  • src/renderer/src/i18n/zh-CN/index.ts
  • src/renderer/src/i18n/zh-HK/common.json
  • src/renderer/src/i18n/zh-HK/image.json
  • src/renderer/src/i18n/zh-HK/index.ts
  • src/renderer/src/i18n/zh-TW/common.json
  • src/renderer/src/i18n/zh-TW/image.json
  • src/renderer/src/i18n/zh-TW/index.ts
  • src/types/i18n.d.ts

Comment on lines +106 to +115
const createLaunchSignature = (launchSpec: AcpResolvedLaunchSpec): string =>
JSON.stringify({
command: launchSpec.command,
args: launchSpec.args ?? [],
env: launchSpec.env ?? {},
cwd: launchSpec.cwd ?? null,
distributionType: launchSpec.distributionType,
version: launchSpec.version ?? null,
installDir: launchSpec.installDir ?? null
})
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.

⚠️ Potential issue | 🟠 Major

Derive launchSignature from the final spawn inputs.

warmupProcess now decides reuse from launchSignature, but the actual child process also depends on inputs that are only applied later in spawnAgentProcess (agentState?.envOverride, npm/uv registry overrides, runtime command expansion/replacement, and cwd fallback). That means some launch-affecting changes can still reuse a stale warmup process, while equivalent env objects with different key insertion order can force needless respawns. Please build the signature from the normalized command/args/env/cwd that will actually be spawned, with env keys sorted before serialization.

Also applies to: 261-262, 312-312

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/presenter/llmProviderPresenter/acp/acpProcessManager.ts` around
lines 106 - 115, The current createLaunchSignature produces a signature from the
resolved launch spec but misses downstream modifications applied in
spawnAgentProcess (like agentState?.envOverride, npm/uv registry overrides,
runtime command expansion/replacement, and cwd fallback) and suffers from env
key order variance; update createLaunchSignature (and the other occurrences of
the same logic) to accept or compute the final spawn inputs used by
spawnAgentProcess (final command and args after expansion, merged env including
agentState?.envOverride and registry overrides, and the effective cwd with
fallback), normalize the env by sorting its keys deterministically before
serialization, and then JSON.stringify the normalized {command, args, env, cwd,
distributionType, version, installDir} so warmupProcess reuses only truly
equivalent spawn inputs.

Comment thread src/renderer/src/i18n/zh-HK/common.json
@zerob13 zerob13 merged commit 18b985b into dev Apr 28, 2026
3 checks passed
@zhangmo8 zhangmo8 deleted the i18n-common-markstream-keys branch April 28, 2026 05:52
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