Skip to content
Development
Skill

/pdlc-i18n

国际化——抽取硬编码文案为 key、生成多语言资源文件并替换引用

From plugin
pdlc
1838 skills2 hooks

Claude Code

$ npx -y skills add kanfu-panda/pdlc-skills --skill pdlc-i18n --agent claude-code

SKILL.md

pdlc-i18n.SKILL.md
name: pdlc-i18n
description: 国际化——抽取硬编码文案为 key、生成多语言资源文件并替换引用
argument-hint: "<目标语言 | 模块名>"
allowed-tools: Read, Write, Edit, Glob, Grep, Bash
layer: 3
stage: engineering
produces: []
requires: []
next_step: null
terminal_state: null

国际化(i18n)

<!-- @include templates/prompts/iron-law-tool.md(已内联于下方,无需另读) --> ⛔ **IRON LAW · 不可违反的硬门禁(工具型命令)**

本命令不是主链路上的阶段:**不追加 `history`,不改 `current_stage` / `next_step` / `last_phase_result`**,也不为此分配功能ID。以下规则不可协商:

1. **文件必须落盘**:正文要求创建的文件必须作为实际文件写入磁盘,不可仅在对话中输出(只要求在对话里输出的,照正文办)。 2. **自检必须执行**:产出后按本命令的自检项逐项核对,不得以"已经很好了"为由跳过。 3. **防循环**:修复只做一次,不递归。修不了的问题记进报告,继续往下走。

**违反任一条 = 立即中止当前命令,输出违规详情,等待人工介入。** <!-- @include-end templates/prompts/iron-law-tool.md -->

为指定的前端应用或后端服务添加国际化支持。

工作流程

1. **扫描硬编码文本**: 查找代码中所有硬编码的中文字符串 2. **提取文本资源**: 生成多语言资源文件 3. **替换硬编码**: 用 i18n 函数调用替换原有的硬编码文本 4. **生成翻译清单**: 输出待翻译的文本列表

前端(React/Vue)

  • 资源文件位置: `src/locales/zh-CN.json`、`src/locales/en-US.json`
  • 使用 `react-i18next` 或 `vue-i18n`
  • Key 命名规范: `模块.页面.组件.描述`,如 `user.login.form.username`

后端(Java/Go/Python/Node)

  • 错误提示信息国际化
  • API 响应消息国际化
  • 根据请求头 `Accept-Language` 返回对应语言

资源文件格式

{
  "common": {
    "confirm": "确认",
    "cancel": "取消",
    "save": "保存",
    "delete": "删除"
  },
  "user": {
    "login": {
      "title": "用户登录",
      "username": "用户名",
      "password": "密码"
    }
  }
}

要求

  • 默认语言为中文(zh-CN)
  • Key 使用英文,值使用对应语言
  • 先生成中文版本,英文版本标记 `// TODO: 待翻译`
  • 日期、数字、货币使用 Intl API 格式化

目标: $ARGUMENTS

<!-- @include templates/prompts/handoff.md(已内联于下方,无需另读) -->

段四:交接(Handoff)

命令完成后必须输出以下格式的最终消息:

✅ <阶段名> 完成:<主要产出物路径>
📊 自检:<通过数>/<总数> 通过(若有未通过,附要点)
📦 状态快照:docs/.pdlc-state/<feature-id>.json
👉 下一步:/pdlc-<next_step>
   (如果有分叉)或 /pdlc-<alt>(条件:<选择依据>)

**规则:**

  • 主流程命令(写状态机的命令;下一跳见正文里「本命令的状态机取值」)必须显式输出"下一步",不可省略
  • 工具型命令(Layer 3)可以没有 `next_step`,此时输出 `👉 下一步:(本次流程结束,无后续)`
  • 分叉场景必须说明**选择条件**,例如"若需补充测试用例 → `/pdlc-tdd`;若测试已齐 → `/pdlc-review`"

<!-- @include-end templates/prompts/handoff.md -->

**本命令的 handoff 输出:**

✅ 国际化资源文件 完成
📦 产出:src/locales/<语言>.json
👉 下一步:(本次流程结束,无后续)
Read more
@kanfu-panda
Ships withpdlc

Author: kanfu-panda Repo: github.com/kanfu-panda/pdlc-skills License: MIT pdlc-skills is built on one rule: an AI saying "done" doesn't count — exit codes do.

Stars on GitHub

Momentum

stars in total
18
Star history of kanfu-panda/pdlc-skills on GitHub, a chart by star-history.com

Other skills on pdlc.

pdlc-add-app

pdlc-add-app

在已有项目里加一个前端应用(先探测布局,跟随现有目录与技术栈);新项目一次性初始化用 /pdlc-bootstrap

@kanfu-panda@kanfu-pandaInstall Skill
pdlc-add-service

pdlc-add-service

在已有项目里加一个后端服务(先探测布局,跟随现有目录与技术栈);新项目一次性初始化用 /pdlc-bootstrap

@kanfu-panda@kanfu-pandaInstall Skill
pdlc-adopt

pdlc-adopt

已有代码、还没有 PDLC 文档的老项目接入——只读扫描后逆向生成基线文档并做健康检查,不改代码;空目录新项目用 /pdlc-bootstrap

@kanfu-panda@kanfu-pandaInstall Skill
pdlc-arch

pdlc-arch

架构分析(生成/更新 docs/ARCHITECTURE.md 系统架构总览 · surface 型)

@kanfu-panda@kanfu-pandaInstall Skill
pdlc-bootstrap

pdlc-bootstrap

空目录从一句话描述初始化新项目(服务 / 应用拆分、技术栈、目录骨架与 PDLC 文档目录);已有代码的项目用 /pdlc-adopt

@kanfu-panda@kanfu-pandaInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about pdlc-i18n.

Which coding agents can use pdlc-i18n?
pdlc-i18n installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.