AgentSkillsCN

localize-strings

当UI字符串被新增或修改时,运行构建插件的本地化工作流——包括提取字符串、生成翻译提示、更新TSV语言文件、嵌入本地化输出,并对结果进行验证。

SKILL.md
--- frontmatter
name: localize-strings
description: Run the build-add-in localization workflow when UI strings are added or changed, including extracting strings, generating translation prompts, updating TSV language files, embedding localized output, and validating results.

Localize Strings Workflow Skill

Use this skill when the user asks to localize new or changed UI strings in this repository.

Purpose

Apply the documented localization process in docs/localize.md and related localize/ files.

Repository Rules

  • Only localize UI strings.
  • Ensure UI strings are wrapped in loc("...") before running localization tooling.
  • If a language translation is missing, English is the fallback.
  • Keep changes minimal and aligned with the existing project style.

Required Workflow

  1. Run string extraction:
    • npm run extract-loc
  2. Perform translation directly:
    • Use localize/translate-prompt.txt as the translation prompt.
    • Generate translated TSV output.
    • Apply results to localize/strings.tsv.
  3. Embed localized language resources:
    • npm run embed-loc
  4. Validate output quality:
    • Spot-check changed strings in src/core/localize/strings.json and generated artifacts.
    • Confirm no obvious formatting or placeholder regressions.
  5. Report exactly what changed and any errors or issues encountered.

Operating Behavior

  • Execute translation directly as part of the workflow; only ask the user for input if translation fails or output is ambiguous.
  • Automatically run localization commands using the platform shell:
    • Windows: run in cmd (cmd /c "npm run extract-loc" and cmd /c "npm run embed-loc").
    • macOS: run in zsh (zsh -lc "npm run extract-loc" and zsh -lc "npm run embed-loc").
  • Preserve TSV formatting exactly (tabs, column order, escaping).
  • Do not introduce new dependencies.
  • Prefer targeted edits; avoid unrelated refactors.

Expected Deliverables

  • Updated localization source files (typically localize/strings.tsv, plus embedded outputs).
  • Short summary including:
    • Commands run.
    • Files changed.
    • Any manual follow-up required.
    • Any strings that remain intentionally untranslated (for example, approved brand/product names).

Quick References

  • Process guide: docs/localize.md
  • Prompt template: localize/translate-prompt.txt
  • Localization table: localize/strings.tsv
  • Embed command source flow: npm run embed-loc