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
Intlayer 兼容适配器
将大型应用程序迁移到新的国际化库可能令人望而生畏。为了简化这一过渡,Intlayer 为生态系统中最流行的 i18n 库提供了兼容适配器。
这些适配器 package 暴露与您现有 i18n 库完全相同的公共 API,但在运行时将所有翻译工作委托给 Intlayer。
工作原理
使用兼容适配器时,您无需重写应用程序的导入或更改翻译 hook 和组件的使用方式。相反,Intlayer 的 bundler 插件会自动将您现有的导入别名指向 Intlayer 兼容 package。
例如,开发者将 import { useTranslation } from 'react-i18next' 替换为 import { useTranslation } from '@intlayer/react-i18next'(通过 bundler 插件自动完成),应用程序继续工作,翻译现在由 Intlayer 字典提供。键值也会与您的 Intlayer 字典进行类型检查!
可用兼容适配器
在下方选择您现有的库,了解如何无缝迁移: