i18n-localization by davila7/claude-code-templates
npx skills add https://github.com/davila7/claude-code-templates --skill i18n-localization国际化 (i18n) 与本地化 (L10n) 的最佳实践。
| 术语 | 含义 |
|---|---|
| i18n | 国际化 - 使应用可翻译 |
| L10n | 本地化 - 实际的翻译内容 |
| Locale | 语言 + 区域 (en-US, tr-TR) |
| RTL | 从右到左书写的语言 (阿拉伯语, 希伯来语) |
| 项目类型 | 是否需要 i18n? |
|---|---|
| 公开的 Web 应用 | ✅ 是 |
| SaaS 产品 | ✅ 是 |
| 内部工具 | ⚠️ 可能 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 单一区域应用 | ⚠️ 考虑未来需求 |
| 个人项目 | ❌ 可选 |
import { useTranslation } from 'react-i18next';
function Welcome() {
const { t } = useTranslation();
return <h1>{t('welcome.title')}</h1>;
}
import { useTranslations } from 'next-intl';
export default function Page() {
const t = useTranslations('Home');
return <h1>{t('title')}</h1>;
}
from gettext import gettext as _
print(_("Welcome to our app"))
locales/
├── en/
│ ├── common.json
│ ├── auth.json
│ └── errors.json
├── tr/
│ ├── common.json
│ ├── auth.json
│ └── errors.json
└── ar/ # RTL
└── ...
| 问题 | 解决方案 |
|---|---|
| 缺少翻译 | 回退到默认语言 |
| 硬编码字符串 | 使用代码检查/检测脚本 |
| 日期格式 | 使用 Intl.DateTimeFormat |
| 数字格式 | 使用 Intl.NumberFormat |
| 复数形式 | 使用 ICU 消息格式 |
/* CSS Logical Properties */
.container {
margin-inline-start: 1rem; /* 而非 margin-left */
padding-inline-end: 1rem; /* 而非 padding-right */
}
[dir="rtl"] .icon {
transform: scaleX(-1);
}
发布前检查:
| 脚本 | 用途 | 命令 |
|---|---|---|
scripts/i18n_checker.py | 检测硬编码字符串和缺失的翻译 | python scripts/i18n_checker.py <project_path> |
每周安装量
295
代码仓库
GitHub 星标数
23.4K
首次出现
Jan 25, 2026
安全审计
安装于
opencode258
gemini-cli252
codex244
github-copilot240
claude-code235
cursor218
Internationalization (i18n) and Localization (L10n) best practices.
| Term | Meaning |
|---|---|
| i18n | Internationalization - making app translatable |
| L10n | Localization - actual translations |
| Locale | Language + Region (en-US, tr-TR) |
| RTL | Right-to-left languages (Arabic, Hebrew) |
| Project Type | i18n Needed? |
|---|---|
| Public web app | ✅ Yes |
| SaaS product | ✅ Yes |
| Internal tool | ⚠️ Maybe |
| Single-region app | ⚠️ Consider future |
| Personal project | ❌ Optional |
import { useTranslation } from 'react-i18next';
function Welcome() {
const { t } = useTranslation();
return <h1>{t('welcome.title')}</h1>;
}
import { useTranslations } from 'next-intl';
export default function Page() {
const t = useTranslations('Home');
return <h1>{t('title')}</h1>;
}
from gettext import gettext as _
print(_("Welcome to our app"))
locales/
├── en/
│ ├── common.json
│ ├── auth.json
│ └── errors.json
├── tr/
│ ├── common.json
│ ├── auth.json
│ └── errors.json
└── ar/ # RTL
└── ...
| Issue | Solution |
|---|---|
| Missing translation | Fallback to default language |
| Hardcoded strings | Use linter/checker script |
| Date format | Use Intl.DateTimeFormat |
| Number format | Use Intl.NumberFormat |
| Pluralization | Use ICU message format |
/* CSS Logical Properties */
.container {
margin-inline-start: 1rem; /* Not margin-left */
padding-inline-end: 1rem; /* Not padding-right */
}
[dir="rtl"] .icon {
transform: scaleX(-1);
}
Before shipping:
| Script | Purpose | Command |
|---|---|---|
scripts/i18n_checker.py | Detect hardcoded strings & missing translations | python scripts/i18n_checker.py <project_path> |
Weekly Installs
295
Repository
GitHub Stars
23.4K
First Seen
Jan 25, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode258
gemini-cli252
codex244
github-copilot240
claude-code235
cursor218
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
106,200 周安装