开发者友好特性
使用 yarn 安装 glotstack
yarn install glotstack
将 glotstack 提供器添加到您的 React 应用
只需在应用顶层添加一次上下文提供者。 添加后,翻译内容会根据您提供的语言自动加载。
<GlotstackProvider initialLocale='en-US' importMethod={importMethod}>
  <YourApp/>
</GlotstackProvider>
详见 React 国际化快速入门 关于 importMethod 的说明
随时按需获取您的翻译
yarn glotstack get-translations
无需再等待语言专家。使用我们的 CLI 随时获取最新翻译。翻译文件中使用 context 确保翻译准确匹配您的意图。想用 YAML 文件请查看 关于 YAML
Glotstack 提供简单的基于 Hook 的 API
const { t } = useGlotstack()

<>
  {t('YourKey', {
    assigns: {
      Component: <Component prop="f"></Component>,
      insertNode: <Icon name="icon-set"/>,
      mdash: <>&mdash;</>
      another: <>{t('OtherKey', {locale: 'en-US'})}
    },
  })}
</>
您可以使用 assigns 选项将任意 React.Node 替换到翻译中。只需在 assigns 中传入相应组件名,即可内联使用 <Component>something</Component> 标记 —— 这在不想新增翻译键时非常实用。也可以直接使用 {{substitution}} 标记替换任意节点。
YourKey:
  value: |
    This is an example source text. We want to <Component>do this</Component.
    We also want to demonstrate {{insertNode}} and {{mdash}}.
    We can even nest other translated things {{another}}.
定价
我们为早期开发团队提供丰厚优惠,详情请查看 价格
敬请期待
新功能即将上线。我们致力于让本地化变得更加简单,专注于提升开发效率。
全新推出
自动提取所有翻译
yarn glotstack extract-translations
使用 CLI 自动提取您用母语编写的源文件字符串。这样,如果愿意,您甚至可以完全忽略翻译文件。继续像以前一样编写代码,glotstack 会处理其余工作。
© 2026 Glotstack.ai。版权所有。
Glotstack 是面向 React 的开发者优先本地化工作流:管理 YAML/JSON 翻译,保持语言同步,借助 AI 工具快速发布新语言。