Agent Skills › smartdoca/doca › doca-i18n

doca-i18n

GitHub

指导为 Doca 编辑器子包或宿主添加界面语言支持,包括增加 locale prop、维护中英文消息目录及处理字典 key 规范。

skills/doca-i18n/SKILL.md smartdoca/doca

Trigger Scenarios

需要为 Doca 编辑器组件添加中文或英文 UI 文案 新增国际化语言支持或修改多语言消息目录

Install

npx skills add smartdoca/doca --skill doca-i18n -g -y
More Options

Use without installing

npx skills use smartdoca/doca@doca-i18n

指定 Agent (Claude Code)

npx skills add smartdoca/doca --skill doca-i18n -a claude-code -g -y

安装 repo 全部 skill

npx skills add smartdoca/doca --all -g -y

预览 repo 内 skill

npx skills add smartdoca/doca --list

SKILL.md

Frontmatter
{
    "name": "doca-i18n",
    "description": "Add interface languages to a Doca editor subpackage (rich text, spreadsheet, Markdown, canvas, slides, and future formats) or the Doca host. Use when adding Chinese\/English UI copy, a locale prop, message catalogs, or another language. Dictionary keys are stable English identifiers, not Chinese or full-sentence English."
}

Doca 界面语言

改编辑器子包或 Doca 宿主的界面文案前,先读 界面语言约定。Doca 仓库里的 docs/i18n.md 是源文件;本 skill 的 references/contract.md 是给子包安装的副本。两边要一起改,不能各写各的。

子包自己保存界面文案。不要引用 Doca 的字典,也不要读取 ui.locale 或 localStorage。

子包要做的事

  1. 给编辑器组件增加可选的 locale?: string。宿主会这样传入:
<RichTextEditor locale={locale} />

当前只有 zh 和 en。不认识的代码按 en 显示。缺省时按 zh 显示。

  1. 字典 key 用稳定的英文标识,例如 toolbar.bold、find.replaceAll。不要用中文,也不要用会随文案修改的整句英文。
  2. 至少提供 en 和 zh 两份目录,key 集合相同。新增语言时只加一份目录。
  3. 占位符写成 {name}。需要区分数量时提供 key.one 和 key.other,调用方传 count。
  4. locale 变化只更新按钮、菜单、占位符和提示。不要因此重建文档、Y.Doc、协同适配器或插件列表。
  5. 可以额外接受 messages?: Record<string, string> 覆盖个别 key。没有这份 prop 也可以。
  6. 用户写进文档的文字、公式、单元格内容不翻译。

宿主只在安装包的类型声明里已经有 locale 时才传入。类型里还没有这个 prop 时不要先传。

增加一种语言

在宿主 locales 和每个编辑器子包里同时加上同一种语言代码和一份与英文 key 相同的目录。不要改已有 key,也不要改调用方式。

Version History

  • 117ce85 Current 2026-10-18 15:23

Same Skill Collection

skills/doca-collaboration/SKILL.md
skills/doca-editor-integration/SKILL.md

Metadata

Files
0
Version
117ce85
Hash
f2764959
Indexed
2026-10-18 15:23

홈 - 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-10-19 02:19
浙ICP备14020137号-1