fix(chatbot): 给工具卡片的名字打通 i18n 通道(cloud#1658) - #6340
Open
os-zhuang wants to merge 2 commits into
Open
Conversation
…loud#1652) '+ add field' appended field_<N> to the DRAFT, and the column array is a fetch input, so the next query named a column the server does not have — 400 INVALID_FIELD, and the whole grid became '该视图的查询被拒绝' with a message pointing at filters that were never there. Boundary measured on a rig, not assumed: saving the field as a draft returns 200/state=draft and the very next select naming it still 400s. Materialisation happens at PUBLISH, so the projection must come from the baseline (layered().effective), which is what publishedFieldNames now carries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A fully Chinese conversation still read 'Describe object 已完成' because humanizeToolName is an English title-caser with no translation path — the name never passed through i18n, so no locale pack could reach it, and the step users most need to read was the one left in a foreign language. Adds an optional translate parameter (shaped for useSafeTranslate) keyed on chatbot.tool.<name>, falling back to the SAME English title as today. Behaviour without a translator is unchanged, which is what makes this safe to land before the call sites and packs follow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
实现 cloud#1658 追加观察的 A 条。
现象(实测,全中文环境)
DOM 取证:叶子节点文本确为
Describe object/Visualize data。根因
humanizeToolName是纯英文构词器(describe_object→Describe object),没有任何 i18n 通道。所以这不是"某个语言包漏翻了",而是名字从未经过翻译——任何语言包都够不着它。卡片上其余每一处都本地化了(状态、动作、回答),偏偏「它现在在做什么」这一步——用户最需要读懂的一步——留在了外语。
改动
humanizeToolName(name, translate?),translate形状即useSafeTranslate(),按chatbot.tool.<tool_name>查;查不到回落到与今天完全一致的英文标题。这一步只打通通道,不改变任何现有显示
不传
translate时行为逐字不变——测试的第一组就在钉这个(老行为:snake/kebab 转换、缩写表URL/AI、空输入)。语言包目前也没有条目,所以合入后界面上看不到任何变化。这样拆是因为:在通道存在之前,翻译工作根本无处可放。后续两件事各自独立、可分别推进:
useSafeTranslate()(ChatbotEnhanced.tsx的summarizeTools是纯函数、另一处在另一作用域,接线需要小心,我没有在本 PR 里硬接);chatbot.tool.*。一个刻意的选择
回落交给英文标题而不是原始名:语言包缺条目时显示
Describe object(与今天相同),而不是describe_object(比今天更差)。有一条测试专门钉这个——它断言传给 translator 的 fallback 参数是'Describe object'。测试
新增 7 条;
plugin-chatbot全量 322 条全过,既有行为未受影响。