技术比较

Paraglide vs react-i18next:编译时 vs 运行时 i18n

Paraglide 更小更严格;react-i18next 更大更宽容。

2026-07-01

Huifer
Huifer · Indie Developer→ /about

我的 i18n 迁移经历: - react-i18next:用了 2 年,bundle 太大,类型体验差 - Paraglide JS:2024 年迁移,bundle 减小 40KB,类型安全 迁移花了 1 天,但之后每次翻译重命名都会触发 TS 错误,这是很大的 DX 提升。下文,我会详细说明迁移的 ROI。

GitHub 仓库 (2)文档 (2)Updated: 2026-07-01

TL;DR

  • 看重包体积、类型安全与可 tree-shake 的翻译,选 Paraglide。
  • 看重成熟度、生态插件与运行时灵活性,选 react-i18next。
维度Paraglide JSreact-i18next
实现方式编译时运行时
包体积开销约 0 KB(可 tree-shake)约 40 KB 核心 + 资源
类型安全完整需加装
生态年龄较新非常成熟
复数 / ICU支持支持
框架支持React、Svelte、Vue 等以 React 为主

包体积经济学

Paraglide 把翻译编译成独立函数。未用的 key 永远不会进包。

react-i18next 会打包运行时 + 当前语言的全部消息。

类型安全

Paraglide 给每个 key 类型。重命名一条消息会触发全代码库的 TS 报错。

react-i18next 的 TS 支持需要主动开启并手动维护。

TanStack Ship 的定位

TanStack Ship 用 Paraglide JS 实现三语(en/zh/de)i18n——包体积友好、类型安全、可 tree-shake。读完想在不自己接线的情况下在真实 SaaS 里试试 Paraglide?TanStack Ship 开箱即含正确配置,包括 hreflang 标签与本地化路由。

常见问题

哪个更小?

Paraglide。

哪个更成熟?

react-i18next。

哪个类型安全更好?

Paraglide。

多框架项目选谁?

Paraglide。

专指 Next.js 呢?

都能用;react-i18next 的 Next.js 教程更多。

相关链接

准备好查看 TanStack Ship 的实际效果了吗?

在 TanStack Start 上推出付费 SaaS,内置 UTM 归因、MRR 仪表板和 14 个增长模块 — 起价 $99。