intlayer-react
Integrates Intlayer internationalization with React component. Use when the user asks to "setup React i18n", create a new translated component, use the "useIntlayer" hook, or configure providers.
- License 许可
- MIT
- 最近更新
- 2026-10-29
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- intlayer-react
- metadata
- { "url": "https://intlayer.org", "tags": [ "i18n", "react", "vite" ], "author": "Intlayer", "license": "Apache-2.0", "support": "contact@intlayer.org", "category": "productivity", "mcp-server": "@intlayer/mcp", "documentation": "https://intlayer.org/doc" }
- description
- Integrates Intlayer internationalization with React component. Use when the user asks to "setup React i18n", create a new translated component, use the "useIntlayer" hook, or configure providers.
02 资源文件 17
- 参考文档LICENCE.md10.7 KB
- 参考文档references/environment_create-react-app.md24.4 KB
- 参考文档references/environment_lynx-and-react.md14.7 KB
- 参考文档references/environment_react-native-and-expo.md18.0 KB
- 参考文档references/environment_tanstack-start.md41.0 KB
- 参考文档references/environment_vite-and-react_react-router-v7-fs-routes.md26.9 KB
- 参考文档references/environment_vite-and-react_react-router-v7.md24.8 KB
- 参考文档references/environment_vite-and-react.md35.7 KB
- 参考文档references/packages_intlayer_exports.md12.4 KB
- 参考文档references/packages_react-intlayer_exports.md13.7 KB
- 参考文档references/packages_react-intlayer_IntlayerProvider.md1.6 KB
- 参考文档references/packages_react-intlayer_MarkdownRenderer.md1.3 KB
- 参考文档references/packages_react-intlayer_t.md5.9 KB
- 参考文档references/packages_react-intlayer_useDictionary.md1.7 KB
- 参考文档references/packages_react-intlayer_useI18n.md5.3 KB
- 参考文档references/packages_react-intlayer_useIntlayer.md1.5 KB
- 参考文档references/packages_react-intlayer_useLocale.md3.4 KB
03 SKILL.md 正文
Intlayer React Usage
Core Philosophy
Intlayer promotes Component-Level Content Declaration. Instead of a massive global translation file, content is declared in *.content.ts files adjacent to the React components that use them.
Workflow
To create a translated component, you need two files:
- Declaration: A content file (e.g.,
myComponent.content.ts) defining the dictionary. - Implementation: A React component (e.g.,
MyComponent.tsx) using theuseIntlayerhook.
1. Declare Content
Create a content file using t() for translations.
File: src/components/MyComponent/myComponent.content.ts
import { t, type Dictionary } from "intlayer";
const content = {
// The 'key' must be unique and matches what you pass to useIntlayer()
key: "my-component",
content: {
text: t({
en: "Welcome",
fr: "Bienvenue",
es: "Hola",
// ... All other locales set in intlayer config file
}),
},
} satisfies Dictionary;
export default content;
Intlayer React Usage
Setup
- Vite and React
- Create React App
- React Router v7
- React Router v7 (fs routes)
- Tanstack Start
- React Native and Expo
- Lynx and React
useIntlayer Hook
import { useIntlayer } from "react-intlayer";
const MyComponent = () => {
const content = useIntlayer("my-dictionary-key");
return (
<div>
<h1>
{/* Return react node */}
{content.text}
</h1>
{/* Return string (.value) */}
<img src={content.text.value} alt={content.text.value} />
</div>
);
};
References
Environments
- Vite and React
- Create React App
- Vite and React (React Router v7)
- Vite and React (React Router v7 FS Routes)
Packages
04 同仓库更多 Skills
ui-ux-pro-max
UI/UX design intelligence for web and mobile. Searchable local database with 84 styles, 192 color palettes, 74 font pairings, 192 product types, 98 UX guidelines, 104 icon entries, 16 GSAP motion presets, and 25 chart types across 22 stacks (React, Next.js, Vue, Nuxt, Svelte, Astro, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui, Jetpack Compose, Angular, Laravel, JavaFX, WPF, WinUI, Avalonia, Uno Platform, UWP, Three.js, and HTML/CSS). Use when designing, building, or reviewing UI: pages, components, color schemes, typography, layout, accessibility, animation, or data visualization.
react-doctor
Use when finishing a feature, fixing a bug, before committing React code, or when the user types `/doctor`, asks to scan, triage, or clean up React diagnostics. Covers lint, accessibility, bundle size, architecture. Includes a regression check and a full local-triage workflow that fetches the canonical playbook.
motion
Animation skill for Motion (prev Framer Motion) and CSS animation. Provides: animation best practices (including specific advice for vanilla JS, React, Vue, Base UI and Radix), documentation and example search, CSS spring and bounce generation, MotionScore code and runtime performance audits, and the visual transition editor. Use when writing animations, working with Motion (motion, motion/react, motion-v, framer-motion), animating a UI, writing CSS linear() springs, auditing performance/jank/layout thrash via code or runtime, searching Motion docs or examples, adding a Motion UI section, or upgrading between Motion versions.
intlayer-usage
Provides general guidelines for using Intlayer in any project. Use when the user asks to "get started with Intlayer", "declare content files", or understand the "project structure" for internationalization.
intlayer-content
Define rich content structures using Intlayer content nodes. Use when the user asks to "create translations", "handle pluralization", "use markdown in content", or implement "conditional content".
intlayer-config
Configures Intlayer project settings and environment variables. Use when the user asks to "setup intlayer.config", "configure locales", or "customize Intlayer settings".