← Browse

@gxfg/add-i18n-locale

B

NaiveTab 浏览器扩展的 i18n 国际化开发指南。当用户要新增/修改翻译文本、添加多语言 key 时使用。涵盖中英文同步更新规则、变量替换模式等,防止遗漏或格式错误。

skillclaude

Install

agr install @gxfg/add-i18n-locale --target claude

Writes 1 file into .claude/skills/, pinned to git-baab9841.

  • .claude/skills/add-i18n-locale/SKILL.md

Document


name: add-i18n-locale description: NaiveTab 浏览器扩展的 i18n 国际化开发指南。当用户要新增/修改翻译文本、添加多语言 key 时使用。涵盖中英文同步更新规则、变量替换模式等,防止遗漏或格式错误。

NaiveTab Add i18n Locale

新增或修改 i18n 翻译文本需遵守以下规则。

文件位置

  • 中文:src/locales/zh-CN.json
  • 英文:src/locales/en-US.json

两个文件必须同步更新,不能只改一个。

Key 命名规范

采用扁平嵌套结构,按功能分组:

{
  "common": {
    "save": "保存",
    "cancel": "取消"
  },
  "setting": {
    "group": {
      "myPane": "我的面板"
    }
  }
}

引用方式:window.$t('common.save') 或模板中 $t('setting.group.myPane')

变量替换

使用 __key__ 占位符 + .replace() 方式,禁止使用 vue-i18n 默认的 {key} 语法:

<!-- 正确 -->
{{ $t('key.xxx').replace('__n__', value) }}

<!-- 错误 -->
{{ $t('key.xxx', { n: value }) }}
// 正确
window.$t('key.xxx').replace('__count__', String(count))

覆盖范围

所有面向用户的文本都必须 i18n,包括但不限于:

  • Dialog 的 title/content/positiveText/negativeText
  • showToast / $notification 文案
  • placeholder、按钮文案
  • Setting 面板的 labelKey

注意事项

  • 写代码时先想 i18n key,再写实现
  • 不要因为"只是 dialog 文案"就跳过 i18n
  • 完整规则见 no-hardcode.md

Trustgrade B

  • passBody integrity

    Whether the stored document is plausibly the kind of file the artifact declares, rather than something fetched by mistake.

  • passType matchnot applicable to this artifact type

    Whether the artifact is really the kind of thing its metadata claims it is.

  • passFreshness

    How long since the source repository was last pushed to.

  • passPrompt injection

    Scans the artifact's own text for instructions aimed at your agent rather than at you.

  • warnLicensecopyleft/unknown — index-and-link only

    Whether the source repository declares an SPDX license permissive enough to redistribute.

How the grade is calculated

Each check contributes 0 points when it passes, 1 when it warns, and 2 when it fails. The total maps to a letter:

  • Aevery check passed
  • Bone warning
  • Ctwo warnings
  • Dprompt injection or body integrity failed, or three warnings
  • Fone of those failed, and something else is wrong

These are automated hygiene checks, not a security audit, and not a dependency or vulnerability scan. A grade of A means nothing was flagged — not that the artifact is safe.

Versions

  • git-baab9841e3f02026-07-31