重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
npx skills add https://github.com/tuesd4y/agent-skills --skill translate通过查找 state="new" 的目标条目,定位源上下文,并建议翻译以供审阅,来翻译 XLF 翻译文件中的新条目。
使用 Bash 工具运行提取脚本:
python3 skills/translate/scripts/find_new_translations.py
这将输出包含所有已更改的 XLF 文件及其 state="new" 条目的 JSON,包括翻译 ID、源/目标文本、行号和占位符。如果 files 数组为空,则通知用户未找到新的翻译。
对于脚本输出中的每个翻译 ID,使用 Grep 工具在代码库中查找其使用情况:
**/*.ts 搜索 @@{ID} 以查找 $localize 字符串广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
**/*.html 搜索 @@{ID} 以查找 i18n 属性对匹配的文件使用 Read 工具,获取周围 5-10 行的上下文。
对于每个 state="new" 条目,向用户展示:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
翻译 ID: {id}
文件: {xlf_file_path}
目标语言: {language_name}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
源文本 (英文):
{source_text}
上下文:
{file_path}:{line_number}
{code_snippet}
建议的翻译:
{proposed_translation}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
等待用户确认后再继续。选项:
对于已批准的翻译,更新 XLF 文件:
<target> 元素内容替换为已批准的翻译state="new" 改为 state="ai"更新前:
<trans-unit id="myTranslationId" datatype="html">
<source>English text</source>
<target state="new">Old or empty translation</target>
</trans-unit>
更新后:
<trans-unit id="myTranslationId" datatype="html">
<source>English text</source>
<target state="ai">Translated text</target>
</trans-unit>
根据文件名模式识别目标语言:
| 文件名模式 | 语言 | 本地名称 |
|---|---|---|
messages.de.xlf | 德语 | Deutsch |
messages.fr.xlf | 法语 | Francais |
messages.es.xlf | 西班牙语 | Espanol |
messages.hu.xlf | 匈牙利语 | Magyar |
关键:完全按照源文件中出现的样子保留所有 XML 占位符元素。这些包括:
| 元素 | 用途 | 示例 |
|---|---|---|
<x id="INTERPOLATION" equiv-text="{{...}}"/> | Angular 插值 | {{count}} |
<x id="INTERPOLATION_n"/> | 多个插值 | 第二、第三个插值 |
<x id="PH" equiv-text="..."/> | 命名占位符 | ICU 表达式 |
<x id="PH_n"/> | 多个占位符 | 额外的占位符 |
<x id="LINE_BREAK" ctype="lb"/> | 换行符 | <br> |
<x id="START_TAG_SPAN"/> | 开始 HTML 标签 | <span> |
<x id="CLOSE_TAG_SPAN"/> | 结束 HTML 标签 | </span> |
<x id="START_BOLD_TEXT"/> | 粗体文本开始 | <b> |
<x id="CLOSE_BOLD_TEXT"/> | 粗体文本结束 | </b> |
包含占位符的示例:
<source>Hello <x id="INTERPOLATION" equiv-text="{{name}}"/>, you have <x id="INTERPOLATION_1" equiv-text="{{count}}"/> messages.</source>
<target state="ai">Hallo <x id="INTERPOLATION" equiv-text="{{name}}"/>, Sie haben <x id="INTERPOLATION_1" equiv-text="{{count}}"/> Nachrichten.</target>
当有多个条目需要翻译时:
git statusstate="new" 条目:通知用户所有翻译都是最新的每周安装次数
101
代码仓库
首次出现
2026年1月30日
安全审计
安装于
opencode89
gemini-cli82
codex81
cursor79
github-copilot77
openclaw76
Translate new entries in XLF translation files by finding state="new" targets, locating source context, and proposing translations for review.
Run the extraction script using the Bash tool:
python3 skills/translate/scripts/find_new_translations.py
This outputs JSON with all changed XLF files and their state="new" entries, including translation IDs, source/target text, line numbers, and placeholders. If the files array is empty, inform the user that no new translations were found.
For each translation ID from the script output, use the Grep tool to find its usage in the codebase:
@@{ID} with file pattern **/*.ts to find $localize strings@@{ID} with file pattern **/*.html to find i18n attributesUse the Read tool on matched files to get 5-10 lines of surrounding context.
For each state="new" entry, present to the user:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Translation ID: {id}
File: {xlf_file_path}
Target Language: {language_name}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Source (English):
{source_text}
Context:
{file_path}:{line_number}
{code_snippet}
Proposed Translation:
{proposed_translation}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Wait for user confirmation before proceeding. Options:
For approved translations, update the XLF file:
<target> element content with the approved translationstate="new" to state="ai"Before:
<trans-unit id="myTranslationId" datatype="html">
<source>English text</source>
<target state="new">Old or empty translation</target>
</trans-unit>
After:
<trans-unit id="myTranslationId" datatype="html">
<source>English text</source>
<target state="ai">Translated text</target>
</trans-unit>
Identify the target language from the filename pattern:
| Filename Pattern | Language | Native Name |
|---|---|---|
messages.de.xlf | German | Deutsch |
messages.fr.xlf | French | Francais |
messages.es.xlf | Spanish | Espanol |
messages.hu.xlf | Hungarian | Magyar |
Critical : Preserve all XML placeholder elements exactly as they appear in the source. These include:
| Element | Purpose | Example |
|---|---|---|
<x id="INTERPOLATION" equiv-text="{{...}}"/> | Angular interpolations | {{count}} |
<x id="INTERPOLATION_n"/> | Multiple interpolations | Second, third interpolation |
<x id="PH" equiv-text="..."/> | Named placeholders | ICU expressions |
<x id="PH_n"/> | Multiple placeholders | Additional placeholders |
Example with placeholders:
<source>Hello <x id="INTERPOLATION" equiv-text="{{name}}"/>, you have <x id="INTERPOLATION_1" equiv-text="{{count}}"/> messages.</source>
<target state="ai">Hallo <x id="INTERPOLATION" equiv-text="{{name}}"/>, Sie haben <x id="INTERPOLATION_1" equiv-text="{{count}}"/> Nachrichten.</target>
When multiple entries need translation:
git statusstate="new" entries found: Inform user that all translations are up to dateWeekly Installs
101
Repository
First Seen
Jan 30, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode89
gemini-cli82
codex81
cursor79
github-copilot77
openclaw76
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
48,700 周安装
<x id="LINE_BREAK" ctype="lb"/>| Line breaks |
<br> |
<x id="START_TAG_SPAN"/> | Opening HTML tags | <span> |
<x id="CLOSE_TAG_SPAN"/> | Closing HTML tags | </span> |
<x id="START_BOLD_TEXT"/> | Bold text start | <b> |
<x id="CLOSE_BOLD_TEXT"/> | Bold text end | </b> |