with one click
i18n-helper
国际化辅助专家,专注于多语言翻译管理、字典维护、翻译一致性检查。用于添加新翻译、检查遗漏翻译、语言切换等场景。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
国际化辅助专家,专注于多语言翻译管理、字典维护、翻译一致性检查。用于添加新翻译、检查遗漏翻译、语言切换等场景。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
| name | i18n-helper |
| description | 国际化辅助专家,专注于多语言翻译管理、字典维护、翻译一致性检查。用于添加新翻译、检查遗漏翻译、语言切换等场景。 |
| voice | ["国际化","多语言","翻译","i18n","本地化"] |
| license | MIT |
| compatibility | opencode |
| metadata | {"author":"user","version":"1.0.0"} |
你是一名国际化辅助专家,帮助开发者管理和维护多语言翻译。
在以下情况下使用此 skill:
apps/web/app/lib/i18n/
├── index.ts # 入口文件,导出 useTranslation
├── types.ts # 类型定义
├── dictionary.ts # 字典加载器
├── api-messages.ts # API 消息翻译
├── dictionary.zh.ts # 中文(默认)
├── dictionary.en.ts # 英文
└── dictionary.ja.ts # 日文
| 语言 | 代码 | 文件 |
|---|---|---|
| 中文(默认) | zh | dictionary.zh.ts |
| 英文 | en | dictionary.en.ts |
| 日文 | ja | dictionary.ja.ts |
import { useTranslation } from '@/app/lib/i18n';
export function MyComponent() {
const { t, locale } = useTranslation();
return (
<div>
<h1>{t('dashboard.title')}</h1>
<p>{t('dashboard.welcome', { name: '用户' })}</p>
</div>
);
}
// dictionary.zh.ts
export const dictionary = {
common: {
save: '保存',
cancel: '取消',
delete: '删除',
confirm: '确认',
},
dashboard: {
title: '仪表盘',
welcome: '欢迎回来,{name}!',
},
task: {
status: {
pending: '待处理',
in_progress: '进行中',
completed: '已完成',
},
},
};
// 硬编码文本(需要国际化)
<button>保存更改</button>
// 国际化后
<button>{t('common.saveChanges')}</button>
// dictionary.zh.ts
common: {
// ...existing
saveChanges: '保存更改',
}
// dictionary.en.ts
common: {
// ...existing
saveChanges: 'Save Changes',
}
// dictionary.ja.ts
common: {
// ...existing
saveChanges: '変更を保存',
}
// types.ts
export type Dictionary = typeof import('./dictionary.zh').dictionary;
// scripts/check-i18n.ts
import { dictionary as zh } from '../apps/web/app/lib/i18n/dictionary.zh';
import { dictionary as en } from '../apps/web/app/lib/i18n/dictionary.en';
import { dictionary as ja } from '../apps/web/app/lib/i18n/dictionary.ja';
function getKeys(obj: object, prefix = ''): string[] {
return Object.entries(obj).flatMap(([key, value]) =>
typeof value === 'object'
? getKeys(value, `${prefix}${key}.`)
: [`${prefix}${key}`]
);
}
const zhKeys = new Set(getKeys(zh));
const enKeys = new Set(getKeys(en));
const jaKeys = new Set(getKeys(ja));
// 找出缺失的键
const missingInEn = [...zhKeys].filter(k => !enKeys.has(k));
const missingInJa = [...zhKeys].filter(k => !jaKeys.has(k));
if (missingInEn.length > 0) {
console.log('Missing in English:', missingInEn);
}
if (missingInJa.length > 0) {
console.log('Missing in Japanese:', missingInJa);
}
// 字典
'greeting': '你好,{name}!今天是你第{days}天使用。'
// 使用
t('greeting', { name: '张三', days: 7 })
// 字典
'tasks.count_zero': '没有任务',
'tasks.count_one': '1 个任务',
'tasks.count_other': '{count} 个任务',
// 使用
t(`tasks.count_${count === 0 ? 'zero' : count === 1 ? 'one' : 'other'}`, { count })
// 字典
status: {
pending: '待处理',
completed: '已完成',
}
// 使用
t('status.pending')
// api-messages.ts
export const apiMessages = {
zh: {
'auth.login.success': '登录成功',
'auth.login.failed': '登录失败,请检查邮箱和密码',
'task.created': '任务创建成功',
'task.deleted': '任务已删除',
},
en: {
'auth.login.success': 'Login successful',
'auth.login.failed': 'Login failed, please check your email and password',
'task.created': 'Task created successfully',
'task.deleted': 'Task deleted',
},
// ...
};
module.action 格式{param} 而非字符串拼接API 测试专家,专注于 RESTful API 测试、Vitest 单元测试、Playwright E2E 测试。用于 API 验证、集成测试、契约测试等场景。
OpenSpec 规范驱动开发工作流专家。用于创建变更提案、实现变更、归档已完成变更。确保所有功能变更都经过规范化的提案和审批流程。
PostgreSQL 数据库专家,专注于直接 SQL 开发(无 ORM)、JSONB、性能优化、事务管理。用于数据库查询优化、schema 设计、复杂 SQL 编写、数据迁移等场景。
TipTap 富文本编辑器专家,专注于 TipTap 扩展配置、自定义节点、表格处理、代码高亮等。用于实现富文本编辑功能、自定义编辑器扩展、解决编辑器问题。
智能分析 git diff,根据相同业务逻辑将更改分为多个 commit,生成符合最佳实践的 commit message(带 Emoji 图标),并推送到远程分支。
用于代码审查。支持本地更改(已暂存或工作树)和远程 Pull Requests(通过 ID 或 URL)。专注于正确性、可维护性和项目标准遵守。