microsoft / microsoft/TypeScript
[Localization] Misleading Chinese translation for TS2561 error message
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
Acknowledgement
- I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.
Comment
Hello TypeScript team,
I encountered a confusing and potentially misleading translation in the Chinese (zh-CN) diagnostic message for error TS2561.
Current Chinese message:
对象字面量只能指定已知的属性,但“comprehensiveFilterTab”中不存在类型“PageState”。是否要写入 comprehensiveFilterList?
Original English message:
Object literal may only specify known properties, but 'comprehensiveFilterTab' does not exist in type 'PageState'. Did you mean to write 'comprehensiveFilterList'?
Issue:
The Chinese translation says:
“但‘comprehensiveFilterTab’中不存在类型‘PageState’”
which literally means “but type ‘PageState’ does not exist in ‘comprehensiveFilterTab’”.
This reverses the logical relationship and is grammatically incorrect, leading developers to misunderstand the error. It should convey that the property 'comprehensiveFilterTab' does not exist in the type 'PageState', not the other way around.
Suggested correction (Chinese):
对象字面量只能指定已知属性,但“comprehensiveFilterTab”在类型“PageState”中不存在。您是否想写“comprehensiveFilterList”?
This version preserves the original meaning and uses natural, unambiguous Chinese.
How to reproduce:
Run tsc --locale zh-CN on code that triggers TS2561, e.g.:
type PageState = { comprehensiveFilterList: string[] };
const state: PageState = { comprehensiveFilterTab: [] }; // TS2561
Thank you for your attention! Accurate error messages are crucial for non-English developers.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 tsc --locale zh-CN 运行提供的 TypeScript 示例,并检查本地化的 TS2561 诊断信息。更新中文措辞,将该属性描述为不存在于 PageState 类型中,然后重新运行复现步骤,并确认修正后的消息保留了英文含义。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- compilers, localization
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 冷清
- 描述清晰度
- 描述清楚
- 新手友好度
- 75/100