Repository navigation
fix(i18n): 完善 Studio 简体中文界面文案 - #4297
Conversation
Signed-off-by: Axiomoth <alearner@splrad.com>
There was a problem hiding this comment.
Pull request overview
Completes Simplified Chinese Studio copy and localizes connection and upload fallback errors.
Changes:
- Updates Chinese workspace, resource, activity, and playground translations.
- Adds matching English and Chinese translation keys.
- Replaces selected hard-coded connection and upload messages with i18n.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Review findings |
|---|---|
web-studio/src/routes/resources/-hooks/use-resource-upload.tsx |
Moderate, 4 votes: stale translator in upload callback dependencies (lines 276 and 490). Moderate, 2 votes: effect omits t from dependencies (line 598). Nit, 2 votes: hard-coded Processing failed bypasses localized fallback (line 582). |
web-studio/src/i18n/locales/zh-CN/workspace.ts |
No review comments. |
web-studio/src/i18n/locales/zh-CN/resources.ts |
Nit, 2 votes: generic upload fallbacks can still display English (line 315). |
web-studio/src/i18n/locales/zh-CN/activity.ts |
Nit, 2 votes: addResource.description still uses Terminal instead of 终端 (line 132). |
web-studio/src/i18n/locales/en/workspace.ts |
No review comments. |
web-studio/src/i18n/locales/en/resources.ts |
No review comments. |
web-studio/src/hooks/use-app-connection.tsx |
No review comments. |
Suppressed comments (8)
web-studio/src/i18n/locales/zh-CN/activity.ts:182
- The heading is localized here, but the empty-state body still says
tool call 输出, even though this locale already translates the same concept as工具调用. This body is user-facing, so the Chinese playground still contains avoidable English; use工具调用输出in the adjacent body string.
heading: '智能体操作会与左侧目录联动',
web-studio/src/i18n/locales/zh-CN/activity.ts:225
- This change translates
active sessionin the missing-session error, but the adjacent success messages still emitactive sessionandsessionverbatim.terminal-panel.tsxrenders all of these for/sessioncommands, so common Chinese CLI output remains mixed-language; translate these labels while preserving the command names and IDs.
'当前没有活动会话,请先打开智能体面板创建会话,或指定 session_id。',
web-studio/src/i18n/locales/zh-CN/activity.ts:248
- The surrounding quick-start copy is now localized, but
terminal.hitsstill says命中 resources ... memory ... skill ...at line 217.terminal-panel.tsxrenders this summary for every search, and this locale already defines the corresponding labels as资源、记忆、技能; translate the summary so the Chinese UI does not retain mixed-language category names.
command: '智能体对话后自动沉淀',
web-studio/src/i18n/locales/zh-CN/resources.ts:10
- The disabled request-log state still renders
Usage/Auditverbatim in Simplified Chinese. This PR already translates the equivalent usage/audit message in workspace copy, so this visible state remains inconsistent and partly untranslated; use the localized wording here as well.
'当前连接没有管理员或 Root 权限,无法显示请求日志。请在“连接与身份”中配置具备控制台用量和审计权限的 API 密钥。',
web-studio/src/routes/resources/-hooks/use-resource-upload.tsx:583
- This only localizes the server-task display fallback. Empty error responses still throw the hard-coded
Processing failedinprocessFileUpload(line 297) andstartRemote(line 424), andmergeServerTaskhas equivalent fallbacks, so these failures still appear in English in zh-CN. Route every fallback through this translation before storing or displaying the task error.
remoteTask.errorMessage || t('processingTasks.errors.failed'),
web-studio/src/routes/resources/-hooks/use-resource-upload.tsx:490
- The cancellation message is also captured by
startRemote, whose dependency list at line 520 omitst. Cancelling a request after the user switches languages therefore can still store the old-language message; use the current translator when the async catch runs or otherwise remove this stale closure.
errorMessage: t('processingTasks.errors.cancelled'),
web-studio/src/routes/resources/-hooks/use-resource-upload.tsx:276
- The
failedtranslation added here is not used when the import response hasstatus: 'error'but an emptyerrorsarray: this callback still throws the hard-codedProcessing failedfallback later in the same function, which is then stored and toasted verbatim. Replace that fallback with this key as well so this upload failure is localized.
throw new Error(t('processingTasks.errors.tempUploadMissingId'))
web-studio/src/routes/resources/-hooks/use-resource-upload.tsx:490
- The remote failure path still creates an error with the hard-coded
Processing failedfallback when the server returns no error text. That value is passed through the catch block and displayed directly, so the newfailedtranslation does not cover this case. Localize the fallback instartRemotetoo.
errorMessage: t('processingTasks.errors.cancelled'),
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: Axiomoth <alearner@splrad.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
web-studio/src/routes/resources/-lib/resource-upload-tasks.ts:122
- When a task already exists in
previousand the server response omitserror, this now discards the existing error message and replaces it with the generic fallback.TaskRecord.erroris optional, so a later refresh can hide a more useful failure detail that was already captured. Preserve an existing non-generic error while still replacing previously generated localized fallbacks on language changes.
? record.error || fallbackMessages.failed
: status === 'cancelled'
? record.error || fallbackMessages.cancelled
Signed-off-by: Axiomoth <alearner@splrad.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
Suppressed comments (1)
web-studio/src/routes/resources/-lib/resource-upload-tasks.ts:106
recordErroris treated as authoritative whenever the server sends any non-empty string, so the new localized fallback is bypassed for the server's own generic failure text. The add-resource worker records a non-empty"resource processing failed"when a processing result has no detailed errors (and exception paths also persist their English message), which means a real failed background task can still show English in zh-CN. Normalize a known generic server error (preferably via a stable error code) to the localized fallback while preserving detailed diagnostic messages.
const recordError =
hasErrorStatus && typeof record.error === 'string' && record.error.trim()
? record.error
: null
Signed-off-by: Axiomoth <alearner@splrad.com>
Signed-off-by: Axiomoth <alearner@splrad.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
web-studio/src/routes/resources/-hooks/use-resource-upload.test.tsx:158
- This test changes the global i18n language but restores it only at the end of the happy-path. If an assertion throws (or the test aborts early), the language may remain mutated and leak into subsequent tests. Wrap the body in a
try/finallyto guarantee restoringpreviousLanguage.
it('updates an empty server error fallback when the language changes', async () => {
const previousLanguage = i18n.language
await i18n.changeLanguage('en')
Signed-off-by: Axiomoth <alearner@splrad.com>
Signed-off-by: Axiomoth <alearner@splrad.com>
yufeng201
left a comment
There was a problem hiding this comment.
以下是本轮确认的问题,均已定位到对应 diff 行。
Signed-off-by: Axiomoth <alearner@splrad.com>
Signed-off-by: Axiomoth <alearner@splrad.com>
说明
本 PR 补全 Studio 的简体中文文案,并将连接、资源上传和监控状态中的硬编码或服务端英文显示值接入统一的本地化处理。
人工参与
关联 Issue
未发现可由本 PR 完整解决的开放 Issue。
变更类型
主要变更
翻译清单
主要翻译文件为
zh-CN/activity.ts、zh-CN/resources.ts和zh-CN/workspace.ts,同时更新了对应英文键和使用这些翻译的组件。国际化维护说明:
docs/en/guides/19-web-studio-internationalization.mddocs/zh/guides/19-web-studio-internationalization.md测试
本地验证结果:
检查清单
截图
未提供。
补充说明
无