Creation:2026-06-13Last update:2026-06-13
将此文档参考到您的 AI 助手ChatGPTClaudeDeepSeekGoogle AI modeGeminiPerplexityMistralGrok
使用您最喜欢的AI助手总结文档,并引用此页面和AI提供商
版本历史
- "Init history"v9.0.02026/6/13
此页面的内容已使用 AI 翻译。
查看英文原文的最新版本Edit this doc
If you have an idea for improving this documentation, please feel free to contribute by submitting a pull request on GitHub.
GitHub link to the documentationCopy
Copy doc Markdown to clipboard
Migrate from Next Translate to Intlayer
Migrating from next-translate to Intlayer is a near drop-in replacement that retains your existing syntax and tags.
What to do
Initialize Intlayer in your project:
bash
复制代码
复制代码到剪贴板
npx intlayer initThe CLI will scaffold your configuration. You can then apply the Intlayer plugin in your next.config.ts, which injects build-time subpath aliases mapping next-translate/useTranslation to @intlayer/next-translate.
What it does under the hood
next-translate provides hooks like useTranslation('ns'), t('ns:key.path'), and the <Trans> component.
Under the hood:
- Interpolation & Plurals: It relies closely on the
react-i18nextadapter behavior. Handled dynamically are{{var}}placeholders and pluralization mapped from suffixes likekey_0,key_one, andkey_other. <Trans>component: Directly supported for HTML-ish tag parsing alongside an array-basedcomponentsprop.- Namespaces: Subpath aliasing ensures that your
useTranslationreferences the correct internal dictionary namespaces without manual modification.