使用 YAML 文件
YAML 文件为人类编写。您可以在 YAML 文件中写翻译,并运行 yarn glotstack get-translations --yaml —— 注意 --yaml 选项。 也可以使用
# en-US.yaml
---
Common:
  Beta:
    context: A label indicating the feature is in beta
    value: Beta

Home:
  hero-title:
    context: Homepage hero title; It's catchy to captivate new viewers {{something, no-parse}}.
    value:
      AI-driven, real-time translation and hyper-localization built for modern
      software teams.
  hero-subtitle:
    context: Homepage hero subtitle
    value:
      Go global instantly with <Purple>AI-powered localization</Purple>. Your product is ready
      for the world  Glotstack makes sure it speaks the right language.
  pro-tip:
    context: A development tip for developers who do server side rendering
    value: |
      <Tip>When to use fetch or import?</Tip><Spacer></Spacer>
      <Fetch>fetch()</Fetch> pulls files from staticly hosted files that you host anywhere like a CDN - this also helps keep
      bundle sizes small if you have a limited bundle size, like on Cloudflare Workers. <Fetch>fetch()</Fetch> is almost always better
      unless your environment cannot support dynamic import syntax, then the <Require>require()</Require> method is your best bet for a 
      little more boilerplate.

      For smaller applications or react-native, we recommend you use <Require>require()</Require> to build the assets into 
      your hosted bundles.

您仍需生成 JSON 文件
运行 glotstack 脚本,将源 YAML 文件转换为 JSON 文件
# looks for {sourceLocale}.yaml outputs {sourceLocale}.json
yarn glotstack yaml-to-json
建议将其作为包入口
© 2026 Glotstack.ai。版权所有。
Glotstack 是面向 React 的开发者优先本地化工作流:管理 YAML/JSON 翻译,保持语言同步,借助 AI 工具快速发布新语言。