i18n-helper
i18n-helper identifies hardcoded strings in your source files and automates the setup of internationalization across frameworks like react-intl, vue-i18n, i18next, and gettext. It generates language files in the format your project needs, replaces text with i18n function calls, and reports translation completeness to catch missing keys.
i18n-helper scans your codebase for hardcoded text and generates internationalization configuration files across multiple frameworks.
AI-generated summary based on this skill's SKILL.md
Install
laolaoshiren/claude-code-skills-zh/i18n-helper · repository language: Python
git clone https://github.com/laolaoshiren/claude-code-skills-zh
cp -r claude-code-skills-zh/skills/i18n-helper ~/.claude/skills/i18n-helpernpx skillfed install laolaoshiren/claude-code-skills-zh/i18n-helperFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How does i18n-helper scan hardcoded text in code for internationalization?
i18n-helper analyzes your source files to identify hardcoded strings that should be externalized for translation. It scans across multiple frameworks including react-intl, vue-i18n, i18next, and gettext, then generates language configuration files in your project's required format—JSON, YAML, or PO. The tool automates the detection process so you don't have to manually hunt through your codebase.
Can i18n-helper help migrate an existing project to support multiple languages?
Yes. i18n-helper streamlines multi-language migration by extracting hardcoded strings, generating i18n configuration files, and replacing text with i18n function calls automatically. It works with existing projects built on React, Vue, Node.js, and other frameworks, letting you add internationalization support without rewriting your entire codebase from scratch.
How does i18n-helper check translation completeness and identify missing translation keys?
i18n-helper reports translation coverage by comparing your language files against detected strings in the source code. It flags missing translation keys so you can spot gaps before deployment. This verification helps ensure no user-visible text is left untranslated across your supported languages.
What formats can i18n-helper generate for language files?
i18n-helper generates translation files in JSON, YAML, and PO formats to match your project's needs. Whether you're using react-intl, vue-i18n, i18next, or gettext, the tool produces the configuration structure your framework expects, eliminating manual file setup.
Does i18n-helper replace hardcoded strings with i18n function calls automatically?
Yes. i18n-helper automates the replacement of hardcoded text with appropriate i18n function calls in your source code. This reduces manual refactoring work and ensures consistent function usage across your project, whether you're working with React, Vue, Node.js, or other supported frameworks.
Can i18n-helper detect and extract user-visible UI text for batch translation?
i18n-helper detects user-visible UI text throughout your codebase and extracts it for batch translation workflows. This bulk extraction capability lets you send all translatable content to translation services at once, streamlining the localization process for multi-language apps.
SKILL.md
rendered from the published skill — quoted content, verbatim
🌍 i18n-helper — 国际化/本地化助手
触发条件
当用户要求以下操作时激活此技能: - 扫描代码中的硬编码中文/英文文本 - 为项目添加国际化支持(i18n) - 批量提取和翻译语言文件 - 检查翻译完整性(缺失 key 检测)
工作流程
1. 项目分析
- 检测项目类型(React/Vue/Angular/Node.js/Python/Java 等)
- 识别已使用的 i18n 框架(react-intl, vue-i18n, i18next, gettext 等)
- 扫描源代码目录结构
2. 硬编码文本扫描
- 在
.js/.jsx/.ts/.tsx/.vue/.py/.java/.go等文件中搜索硬编码字符串 - 排除:变量名、URL、正则表达式、import 路径、日志调试信息
- 标记:用户可见的 UI 文本、错误提示、通知消息
3. 语言文件生成
根据项目框架生成对应格式:
- JSON (i18next/react-intl): { "key": "value" }
- YAML (vue-i18n): key: value
- PO/POT (gettext): 标准格式
- Properties (Java): key=value
4. 代码替换
- 将硬编码文本替换为 i18n 函数调用
- 保持原有格式和变量插值
- 示例:
javascript // 替换前 alert('保存成功'); // 替换后 alert(t('alert.saveSuccess'));
5. 完整性检查
- 对比主语言文件与翻译文件的 key 差异
- 输出缺失翻译的 key 列表
- 统计翻译完成度百分比
输出格式
## 📊 i18n 扫描报告
### 硬编码文本
| 文件 | 行号 | 内容 | 建议 key |
|------|------|------|----------|
| src/App.tsx | 42 | '欢迎使用' | page.welcome |
### 语言文件
已生成 `locales/zh-CN.json` 和 `locales/en-US.json`
### 翻译完整性
- zh-CN: 45/45 (100%) ✅
- en-US: 42/45 (93.3%) ⚠️ 缺少 3 个 key
支持的 i18n 框架
- react-intl /
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 1 file
skills/i18n-helper/SKILL.md