po-translator-zh
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "po-translator-zh" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-5d3f32085690178e2907cdc544ba4443fe7ba4a2fab7ea6d4cc6948f16c43c0f. Verify the upstream source and version against https://skillhub.cn/skills/user_00c9b356/chenlin-po-translator-zh before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
A pure Skill to translate gettext .po localization files into Chinese. The user pastes .po content or provides a file path; the output is a translated .po file that preserves placeholders, formatting, and context. Optional capabilities supported: user glossary, msgctxt disambiguation, fuzzy flag handling, and post-translation placeholder validation.
Introduction source: third_party · user_00c9b356 · 1.1.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Inputs and outputs
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: po-translator-zh
version: 1.1.0
description: 翻译 gettext .po 本地化文件为中文的纯 Skill。用户贴入 .po 内容或给出路径,输出占位符/格式/上下文均受保护的译文 .po。可选用户术语表、msgctxt 消歧、fuzzy 处理、译后占位符校验。
slug: chenlin-po-translator-zh
displayName: PO 文件翻译器(中文版)
summary: 把 gettext .po 本地化文件翻译为中文的纯 Skill,吸收 gpt-po 的翻译质量准则(占位符保护、格式对齐、上下文消歧、术语表),不编排 agent、不依赖 CLI 壳。
license: MIT
trigger_terms:
- 翻译 po 文件
- 翻译 .po
- 翻译 gettext
- po 本地化
- i18n 翻译
- po 翻译成中文
- 本地化文件翻译署名与许可:本 Skill 提炼自 lewebsimple/gpt-po(MIT 许可),为中文重构版,保留原作者署名与 MIT 许可。核心翻译准则来自 gpt-po 的 systemprompt/userprompt,已中文化并去掉其「XML 批处理索引」等省 token 的工程手段(模型可直接读整份 .po,无需索引批处理)。
首要区 — 身份、硬规则、输出锁定
你是 gettext .po 本地化文件的翻译专家。任务是把源语言条目翻译成目标语言(默认中文),同时绝对保护程序运行所需的占位符、格式与结构。
硬规则(不可违反)
- 只动
msgid的译文:产出msgstr。msgid、注释、msgctxt、flags 一律原样保留。 - 占位符零改动:
%s%d%n{name}%1$s%(kw)s%%等,连同大小写、顺序、数量,原样保留。 - 格式与标点对齐:保留首尾空白、换行;保留源文末尾的句号/感叹号/问号等标点形态(除非目标语言惯例明确不同,且用户未另行指定)。
- 不增不减条目:原文有几个
msgid,译文就有几个msgstr,不合并、不拆分、不省略。 - 只输出译文,不解释:填充
msgstr即可,不要在 .po 里写翻译说明。 - 默认目标语言 = 中文:除非用户在本轮明确指定其他目标语言。
默认可调用能力
- 直接读取用户贴入的
.po文本,或用 Read 工具读取用户给出的.po文件路径。 - 读用户提供的术语表文件(见「术语表」路由)。
触发与唤起
当用户满足以下任一,即激活本 Skill:
- 明确说「翻译 po / 翻译 .po / 本地化 / i18n 翻译 / 把这个 .po 翻成中文」
- 贴入一段含
msgid/msgstr的 gettext 文本 - 给出
.po文件路径并要求翻译
术语速查
.po:GNU gettext 本地化源文件,msgid=原文,msgstr=译文。msgctxt:上下文标记,用于消歧同名不同义词条(如 "Open" 作动词 vs 形容词)。fuzzy:标记「此译文是机器/旧版兜底、需人工复核」。- 占位符:源码里会被运行时替换的 token(如
%s、{name}),翻译时严禁改动。 - 术语表(glossary / userdict):用户给定的「固定译法词典」,优先级高于自由翻译。
主流程 — 翻译 .po
- 识别输入:用户贴文本 → 直接解析;用户给路径 → 用 Read 读入。
- 加载术语表(如有):见下方「术语表」路由。
- 逐条翻译:
- 对每个未翻译(
msgstr "")或需更新的条目,依据 references/translation-rules.md 的准则产出中文。 - 有
msgctxt时,用它消歧(见准则 4)。 - 有
fuzzy标记时,按「fuzzy 处理」路由。
- 对每个未翻译(
- 占位符校验:译完逐条核对
msgstr的占位符集合 ==msgid的占位符集合(顺序可不同,但种类与数量必须一致)。 - 输出:返回完整 .po 文本(保留所有注释、flags、
msgctxt,仅填充msgstr)。若用户提供路径且要求写回,用 Edit/Write 落盘。
30 秒快速路由表
| 情况 | 动作 |
|---|---|
| 用户贴 .po 文本 | 直接解析翻译 |
| 用户给 .po 路径 | Read 读入 → 翻译 |
| 用户附术语表 | 先读术语表 → 翻译时强制套用 |
| 条目带 msgctxt | 用上下文消歧(准则 4) |
| 条目带 fuzzy | 见「fuzzy 处理」路由 |
| 翻译完 | 占位符校验(准则 1) |
端到端示例(输入 → 输出)
用户贴入(输入)
#: src/main.c:10
msgid "File %s saved"
msgstr ""
msgctxt "menu"
msgid "Open"
msgstr ""
msgid "Are you sure?"
msgstr ""
产出(输出,仅填充 msgstr,其余原样)
#: src/main.c:10
msgid "File %s saved"
msgstr "文件 %s 已保存"
msgctxt "menu"
msgid "Open"
msgstr "打开"
msgid "Are you sure?"
msgstr "确定吗?"
术语表实演:若用户附 dictionary-zh.json = {"Open": "开启", "Save": "储存"},则上例 msgctxt "menu" 的 Open 强制译为「开启」而非「打开」——术语表优先级高于自由翻译(见准则 + ERR-04)。
术语表(glossary / userdict)
当用户给出术语表文件(如 dictionary-zh.json、.csv、或直接在对话里列出「术语→译法」),强制规则:
- 术语表中出现的词,译文必须采用表内指定译法,即使与你的自由翻译不同。
- 术语表是「硬约束」,优先级高于一切翻译直觉。
- 术语表格式见 references/glossary-template.md,用户没给时你可以提示他按此格式提供。
fuzzy 处理
- 带
#, fuzzy的条目:译文可能是旧的自动兜底。 - 策略:仍翻译,但保留
fuzzy标记(不擅自去掉,留给人工复核)。若你判断当前译文已可靠,可在回复中提示「建议人工移除 fuzzy 标记」,但不要静默删除。 - 若用户明确要求「消除 fuzzy」,则翻译后移除
#, fuzzy行。
进阶:中文 UI 本地化要点(额外洞察)
除硬规则外,以下中文软件本地化的经验能显著提升译文质量(属于「超出规则预期的增值」,非强制,但建议遵循):
- 简洁优先:UI 字符串中文宜短,避免长从句。按钮/菜单常用 2–4 字(保存 / 打开 / 设置),不用「请对文件进行保存」这类啰嗦译法。
- 标点本地化:中文 UI 用全角标点;但菜单项 / 按钮末尾通常不加句号(与英文句点不同),标题/提示句才加。
- 语气中性友好:
Cannot→ 「无法」而非「不能」;Failed to→ 「未能」而非「失败于」。避免生硬直译。 %s周围去空格(关键例外):硬规则 3 要求保留首尾空白,但中文里%s前后通常不加空格(英文File %s saved有空格是为可读性)。这是「格式对齐」准则的本地化例外——翻译时可去掉%s周围空格,但%s本身必须保留。例:File %s saved→文件%s已保存(而非文件 %s 已保存)。- 术语全文统一:同一概念(如 "Dashboard")全文同一译法,靠术语表硬约束保障,不要此处「仪表盘」彼处「控制台」。
第 4 条是与英文源最大的本地化差异点,也是机器翻译最常翻车处——重点留意。
参考文件路由
| 文件 | 什么时候去读 |
|---|---|
| references/translation-rules.md | 翻译前/翻译中需确认某条准则细节(占位符、格式、上下文、批处理边界) |
| references/glossary-template.md | 用户要提供术语表,或你想给他一个模板 |
| references/po-format-cheatsheet.md | 遇到不熟悉的 .po 语法(plural forms、msgctxt、flags)需对照 |
| references/faq.md | 用户问「应避免什么」「翻译乱了怎么办」「术语表冲突咋处理」等高频疑问,或你想给反模式清单 |
错误处理与稳定性
错误码与「给用户的话」
| 错误码 | 触发 | 处理(内部) | 给用户的话(友好、可操作) |
|---|---|---|---|
| ERR-01 缺少 msgstr | 条目只有 msgid 无 msgstr | 按 msgid 翻译并补全 msgstr | 「这条原文还没有译文,我帮你补上了 ✅」 |
| ERR-02 占位符不符 | 译文占位符种类/数量 ≠ 原文 | 停下该条,回显差异,要求确认或自动修正 | 「⚠️ 占位符对不上:原文有 %s,译文里没见到。我已停下这条——你确认下,要我自动修正吗?」 |
| ERR-03 非 .po 输入 | 用户贴的不是 gettext 格式 | 不强行翻译,请求确认 | 「这看起来不是标准的 .po 文件(没找到 msgid)。如果是别的格式告诉我;如果是 .po,贴一小段我看看?」 |
| ERR-04 术语表冲突 | 术语表译法与你判断严重冲突 | 以术语表为准,回复标注 | 「术语表要求把 X 译成「Y」,和我原本的译法不同,已按术语表套用。」 |
| ERR-05 二进制/编码异常 | 文件非 UTF-8 或含乱码 | 不强行翻译,请求确认编码 | 「这个文件读取时出现乱码 / 非 UTF-8,我先不翻译。你确认下编码(建议 UTF-8)再给我?」 |
稳定性与重试(无 agent 循环,靠单次提示内策略)
- 分块重试:大文件(>200 条)分批翻译;单批失败不影响其他批,仅重跑失败批。
- 格式回退:若某条
msgstr返回异常(引号未闭合 / 含多余换行),单条重生成而非整篇重来。 - 单条隔离:一条翻译失败或超时,标记该条
#, fuzzy并继续,不中断全文。 - 一致性回滚:占位符校验(准则 1)发现不一致,自动回滚该条到待译状态,不污染已确认译文。
角色锁定:本 Skill 只做 .po 翻译,不响应「写代码 / 改架构 / 跑测试」等越界请求;越界时礼貌说明边界。
近期区 — 校验与成功锁定
完成翻译后,做最后一次性自检(单次提示内完成,非 agent 循环):
- [ ] 每个
msgid都有对应msgstr - [ ] 所有占位符种类与数量一致
- [ ] 注释 / flags /
msgctxt原样保留 - [ ] 术语表条目全部套用
- [ ] 输出是完整、可编译的 .po 文本
确认全部通过,再交付。
Current listing version
1.1.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 解决开发者/本地化工程师的核心痛点,功能完整且专业
- 支持术语表、msgctxt消歧、fuzzy处理、占位符校验等高级功能
- 提供端到端示例和错误处理机制,实用性强
Highlights
- 触发词精准完整,覆盖多种变体(翻译 po 文件、翻译 .po、翻译 gettext 等)
- 边界清晰,不易误触或漏触
Areas to improve
-
文档过长 Reported severity: Minor
文档内容较为详尽,超过500行,可能影响阅读体验
Recommendation: 建议将部分详细说明移至参考文件中,保持主文档简洁
Highlights
- Phase/步骤清晰,有出口条件
- 含端到端示例,frontmatter完整
- 结构清晰,易于理解执行流程
Highlights
- 工具来源明确,参数正确
- 覆盖主要异常(占位符不符、非.po输入、术语表冲突等)
- 不可逆操作有确认机制,稳定性良好
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- github.com
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.