goman-translations

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Goman Translations Skill

Goman 翻译技能

Translation management for multi-language apps via the goman.live API.
通过goman.live API管理多语言应用的翻译内容。

First-time setup (run once before anything else)

首次设置(在执行任何操作前运行一次)

Check if
.env
exists in the project root.
If it does NOT exist — create it right now:
GOMAN_API_KEY=your_api_key_here
GOMAN_APP_ID=your_application_id_here
Then tell the user:
.env
created. Please fill in
GOMAN_API_KEY
and
GOMAN_APP_ID
with values from the goman.live dashboard → Settings → API Keys, then ask me to continue.
Do not run any scripts until the user confirms credentials are filled in.
Get both values from the goman.live dashboard → Settings → API Keys.
检查项目根目录下是否存在
.env
文件。
如果不存在——立即创建:
GOMAN_API_KEY=your_api_key_here
GOMAN_APP_ID=your_application_id_here
然后告知用户:
.env
文件已创建。请从goman.live控制台 → 设置 → API密钥中获取值,填入
GOMAN_API_KEY
GOMAN_APP_ID
,之后再让我继续操作。
在用户确认凭据已填写完成前,请勿运行任何脚本。
可从goman.live控制台 → 设置 → API密钥 获取这两个值。

Available Scripts

可用脚本

ScriptWhat it doesExample
goman-languages.js
List active language codes
node goman-languages.js
goman-namespaces.js
List translation namespaces
node goman-namespaces.js
goman-get.js <fullKey>
Get translations for a key
node goman-get.js auth.login.button
goman-search.js [opts]
Search/filter translations
node goman-search.js --namespace auth.login --query button
goman-create.js <fullKey> <json> [ctx]
Add or update translations
node goman-create.js auth.login.button '{"en":"Log in","be":"Увайсці"}' "Login button"
goman-delete.js <fullKey>
⚠️ Delete a key permanently
node goman-delete.js auth.login.button
All scripts output JSON. Parse with
JSON.parse()
when processing results.
脚本功能示例
goman-languages.js
列出可用语言代码
node goman-languages.js
goman-namespaces.js
列出翻译命名空间
node goman-namespaces.js
goman-get.js <fullKey>
获取指定键的翻译内容
node goman-get.js auth.login.button
goman-search.js [opts]
搜索/筛选翻译内容
node goman-search.js --namespace auth.login --query button
goman-create.js <fullKey> <json> [ctx]
添加或更新翻译内容
node goman-create.js auth.login.button '{"en":"Log in","be":"Увайсці"}' "Login button"
goman-delete.js <fullKey>
⚠️ 永久删除一个翻译键
node goman-delete.js auth.login.button
所有脚本均输出JSON格式内容。处理结果时可使用
JSON.parse()
解析。

Key Format

键格式

namespace.key
  • Namespace = everything before the last dot
  • Key = everything after the last dot
  • Example:
    "screens.login.submitButton"
    → namespace
    "screens.login"
    , key
    "submitButton"
⚠️ Every
fullKey
must contain at least one dot.
namespace.key
  • 命名空间 = 最后一个点之前的所有内容
  • 键 = 最后一个点之后的所有内容
  • 示例:
    "screens.login.submitButton"
    → 命名空间为
    "screens.login"
    ,键为
    "submitButton"
⚠️ 每个
fullKey
必须包含至少一个点。

Workflows

工作流

1. Add a Single Translation Key

1. 添加单个翻译键

STEP 1: node goman-languages.js          → get valid language codes
STEP 2: node goman-get.js <fullKey>      → check if key already exists
STEP 3: node goman-create.js <fullKey> <json> <context>  → create/update
步骤1:node goman-languages.js          → 获取有效的语言代码
步骤2:node goman-get.js <fullKey>      → 检查该键是否已存在
步骤3:node goman-create.js <fullKey> <json> <context>  → 创建/更新翻译

2. Localize a Component

2. 组件本地化

STEP 1: Receive component code from user
STEP 2: Find ALL hardcoded user-visible strings
        (labels, placeholders, titles, errors, tooltips — skip console.log, URLs, CSS)
STEP 3: node goman-languages.js
STEP 4: Plan keys: namespace = component name, key = descriptive name
        Show plan to user and ask: "Should I proceed?"
STEP 5: After confirmation → node goman-create.js for each key (all languages at once)
STEP 6: Show replacement code snippets:
        Before: <button>Submit</button>
        After:  <button>{t("LoginForm.submitButton")}</button>
步骤1:接收用户提供的组件代码
步骤2:找出所有硬编码的用户可见字符串
       (标签、占位符、标题、错误提示、工具提示 —— 忽略console.log、URL、CSS内容)
步骤3:node goman-languages.js
步骤4:规划键:命名空间 = 组件名称,键 = 描述性名称
        向用户展示规划并询问:"是否继续?"
步骤5:获得确认后 → 为每个键执行node goman-create.js(一次性处理所有语言)
步骤6:展示代码替换示例:
        替换前:<button>Submit</button>
        替换后:<button>{t("LoginForm.submitButton")}</button>

3. Search / Audit Translations

3. 搜索/审核翻译内容

STEP 1: node goman-namespaces.js         → understand project structure
STEP 2: node goman-search.js             → filter by namespace or search query
STEP 3: node goman-languages.js          → compare found keys vs active languages
STEP 4: Report missing translations per key
步骤1:node goman-namespaces.js         → 了解项目结构
步骤2:node goman-search.js             → 按命名空间或搜索关键词筛选
步骤3:node goman-languages.js          → 对比找到的键与可用语言
步骤4:报告每个键缺失的翻译内容

4. Localize a Folder

4. 文件夹本地化

STEP 1: List files in the folder (ask user if not provided)
STEP 2: For each file: find hardcoded strings
STEP 3: node goman-languages.js
STEP 4: Show full plan across all files, ask confirmation
STEP 5: Batch node goman-create.js calls
STEP 6: Show replacement code for each file
步骤1:列出文件夹中的文件(若用户未提供则询问)
步骤2:逐个文件查找硬编码字符串
步骤3:node goman-languages.js
步骤4:展示所有文件的完整规划,请求用户确认
步骤5:批量执行node goman-create.js调用
步骤6:展示每个文件的代码替换内容

Safety Rules

安全规则

  1. NEVER run
    goman-delete.js
    without explicit user confirmation
  2. ALWAYS run
    goman-languages.js
    first — only use language codes it returns
  3. ALWAYS show what will be affected before destructive actions
  4. ALWAYS include
    context
    argument in
    goman-create.js
    — it helps translators
  5. Present results in readable format, never raw JSON
  1. 切勿在未获得用户明确确认的情况下运行
    goman-delete.js
  2. 始终先运行
    goman-languages.js
    ——仅使用它返回的语言代码
  3. 始终在执行破坏性操作前展示受影响的内容
  4. 始终
    goman-create.js
    中包含
    context
    参数——这对翻译人员有帮助
  5. 以可读格式呈现结果,切勿直接展示原始JSON

Detailed Workflows

详细工作流

For complex scenarios, see workflows.md.
复杂场景请参考 workflows.md