internationalization-i18n by aj-geddes/useful-ai-prompts
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill internationalization-i18n在应用程序中实现国际化和本地化的综合指南。涵盖消息翻译、复数形式、日期/时间/数字格式化、从右到左语言支持以及与流行 i18n 库的集成。
最小工作示例:
// i18n.ts
import i18next from "i18next";
import Backend from "i18next-http-backend";
import LanguageDetector from "i18next-browser-languagedetector";
await i18next
.use(Backend)
.use(LanguageDetector)
.init({
fallbackLng: "en",
debug: process.env.NODE_ENV === "development",
interpolation: {
escapeValue: false, // React already escapes
},
backend: {
loadPath: "/locales/{{lng}}/{{ns}}.json",
},
detection: {
order: ["querystring", "cookie", "localStorage", "navigator"],
caches: ["localStorage", "cookie"],
},
});
// ... (完整实现请参阅参考指南)
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
references/ 目录下的详细实现:
| 指南 | 内容 |
|---|---|
| i18next (JavaScript/TypeScript) | i18next (JavaScript/TypeScript) |
| React-Intl (Format.js) | React-Intl (Format.js) |
| Python i18n (gettext) | Python i18n (gettext) |
| 日期和时间格式化 | 日期和时间格式化 |
| 数字和货币格式化 | 数字和货币格式化 |
| 复数规则 | 复数规则 |
| 从右到左语言支持 | 从右到左语言支持 |
| 翻译管理 | 翻译管理 |
| 区域设置检测 | 区域设置检测 |
| 服务端 i18n | 服务端 i18n |
每周安装数
151
代码仓库
GitHub 星标数
116
首次出现
2026年1月21日
安全审计
安装于
opencode129
gemini-cli125
codex121
claude-code115
cursor109
github-copilot107
Comprehensive guide to implementing internationalization and localization in applications. Covers message translation, pluralization, date/time/number formatting, RTL languages, and integration with popular i18n libraries.
Minimal working example:
// i18n.ts
import i18next from "i18next";
import Backend from "i18next-http-backend";
import LanguageDetector from "i18next-browser-languagedetector";
await i18next
.use(Backend)
.use(LanguageDetector)
.init({
fallbackLng: "en",
debug: process.env.NODE_ENV === "development",
interpolation: {
escapeValue: false, // React already escapes
},
backend: {
loadPath: "/locales/{{lng}}/{{ns}}.json",
},
detection: {
order: ["querystring", "cookie", "localStorage", "navigator"],
caches: ["localStorage", "cookie"],
},
});
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| i18next (JavaScript/TypeScript) | i18next (JavaScript/TypeScript) |
| React-Intl (Format.js) | React-Intl (Format.js) |
| Python i18n (gettext) | Python i18n (gettext) |
| Date and Time Formatting | Date and Time Formatting |
| Number and Currency Formatting | Number and Currency Formatting |
| Pluralization Rules | Pluralization Rules |
| RTL (Right-to-Left) Language Support |
Weekly Installs
151
Repository
GitHub Stars
116
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode129
gemini-cli125
codex121
claude-code115
cursor109
github-copilot107
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
111,800 周安装
| RTL (Right-to-Left) Language Support |
| Translation Management | Translation Management |
| Locale Detection | Locale Detection |
| Server-Side i18n | Server-Side i18n |