← Back to list

i18n-consistency
by Hsiung-Shao
⭐ 0🍴 0📅 Jan 18, 2026
SKILL.md
name: i18n-consistency description: Ensures translation keys are consistent across all supported locales.
i18n Consistency Skill
Use this skill whenever you modify, add, or delete translation keys in the project. This ensures that zh-TW (Source of Truth) stays in sync with zh-CN, en, ja, and ko.
1. Context & Configuration
- Source Language:
zh-TW - Target Languages:
zh-CN,en,ja,ko - Locales Directory:
src/i18n/locales/ - Structure: Files are separated by namespace (e.g.,
common.ts,navbar.ts). - Key Strategy: The project typically uses flat keys (e.g.,
'menu.title': '...') or object structure depending on the file. Check existing patterns in the file. - Important:
src/i18n/i18n.tsmight havekeySeparator: false. If so, nested keys won't work standardly; use flat dotted keys if the config demands it, or match the existing file structure exactly.
2. strict Workflow for i18n Changes
Step 1: Analyze
Before editing, list all language files that need to be updated.
- If you add a key to
zh-TW/common.ts, you MUST also update:zh-CN/common.tsen/common.tsja/common.tsko/common.ts
Step 2: Implementation (Add/Update)
- Edit Source (
zh-TW): Add the new key/value. - Translate & Propagate:
- zh-CN: Convert traditional to simplified.
- en: Translate to English.
- ja: Translate to Japanese.
- ko: Translate to Korean.
- Format Check:
- Ensure the key name is IDENTICAL across all files.
- Preserve indentation and sorting if possible.
Step 3: Verification (Crucial)
If you have made multiple changes, DO NOT rely on manual checking alone.
- Create a temporary script (e.g.,
scripts/verify-i18n-temp.js) to compare keys. - The script should:
- Read keys from
zh-TWfiles. - Compare against all other locales.
- Log any missing keys.
- Read keys from
- Run the script and fix any missing keys immediately.
- Delete the script after verification.
3. Reference Script
Use this Node.js logic for verification if needed:
const fs = require('fs');
const path = require('path');
const localesDir = path.join(__dirname, '../src/i18n/locales');
const sourceLang = 'zh-TW';
const targetLangs = ['en', 'zh-CN', 'ja', 'ko'];
// Helper to extract keys (simple regex approach)
function extractKeys(filePath) {
if (!fs.existsSync(filePath)) return new Set();
const content = fs.readFileSync(filePath, 'utf-8');
const keys = new Set();
// Match 'key': or "key":
const regex = /^\s*(['"])(.+?)\1\s*:/gm;
let match;
while ((match = regex.exec(content)) !== null) {
keys.add(match[2]);
}
return keys;
}
// ... iteration logic to compare sourceKeys vs targetKeys ...
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon