1k i18n

From OneKeyHQ/app-monorepo · View interactive version

1k i18n is an AI agent skill from the GitHub repository OneKeyHQ/app-monorepo. OneKey i18n workflow for module copy, full-language translation create/update, bilingual previews and confirmed writes to OneKeyHQ/onekey-i18n, then pull and verification. Never edit generated translations.

How to use this skill

Skill file

OneKey i18n

App translations live in OneKeyHQ/onekey-i18n

(projects/app). Copy changes are PRs there; this repository pulls the generated

files from its releases. Use repository scripts for scanning, merging, previews,

writes and verification. The model selects scope, judges reuse, writes copy and translates.

Rules

.skillshare/skills/ui-copy/SKILL.md and follow its rules.

a key leaves released app bundles unchanged; later pulls and builds receive it.

match. Do not duplicate legacy keys for naming consistency or change shared copy

unless explicitly in scope.

product tone. Do not use English as a placeholder for untranslated languages.

locale catalogs. Review dynamic expressions and imported copy the scanner cannot resolve.

| Mode | Missing key or empty/whitespace translation | Existing non-empty translation |

| -------------------- | ------------------------------------------- | ------------------------------------- |

| complete (default) | Create or fill | Preserve |

| update | Create or fill | May update within the requested scope |

Both modes use upsert. Do not silently switch modes to bypass a rejected overwrite.

Setup

(yarn op). Opening onekey-i18n PRs uses your own gh auth login identity, which needs

write access to OneKeyHQ/onekey-i18n. No checkout of onekey-i18n is needed.

Workflow

Paths are relative to the repository root; use .tmp/i18n/<task>/ for <dir>.

  1. Pull before selecting or translating copy, in both modes:

yarn i18n:sync --out <dir>/sync.json.

It pulls the latest app release. Preserve unknown local generated changes if the

script blocks; use recovery guidance.

  1. Locate the module with rg, then run

yarn i18n:workflow scan --mode <mode> --sync <dir>/sync.json --module <path> --out <dir>/draft.json.

Repeat --module for related copy. For explicit updates to already complete keys,

add --include-complete and limit edits to the requested keys/languages.

  1. Read draft.json.summary.json and relevant code. Search reusable keys with

yarn i18n:search. Choose upsert/reuse or ignore (with a reason); fill missing

or requested translations using the patch format.

Use inspect --file <draft> to check remaining work.

  1. Generate a plan with a new filename:

yarn i18n:plan --file <dir>/draft.json --out <dir>/plan.json.

Scripts generate JSON, Markdown and HTML; never write one-off preview HTML.

  1. Paste the generated Markdown into the conversation, provide the HTML link,

state mode/change scope, and wait for confirmation. Markdown shows only English

and Simplified Chinese, including old → new wording for updates:

| Key | Copy |

| ---- | ------------ |

| key1 | English text |

| | 中文文案 |

If the user returns HTML feedback, follow feedback import.

Edits/comments request a revision, not write approval. Changes to copy, scope,

mode or baseline require a new preview and confirmation.

  1. After confirmation, run

yarn i18n:apply --file <dir>/plan.json --approve <confirmed-hash>.

It commits every locale to a new onekey-i18n branch through the GitHub API, opens

the onekey-i18n PR (link in the receipt), waits for that PR's CI preview (about a

minute or two), pulls it and verifies the generated files. Check the receipt and

full generated diff, including unrelated changes; use recovery guidance if

interrupted. A rerun with the same hash reuses the opened PR.

  1. The onekey-i18n PR needs its CI and one reviewer. Report its link.
  2. Wire generated keys into the requested module, rescan and run appropriate checks.

Until the onekey-i18n PR merges, the generated files come from its preview and

this repository's PR must not merge. After it merges and its release is published,

run yarn i18n:pull (latest release), then commit the files. Report the onekey-i18n PR, locale count, pull verification, unrelated

generated changes and code wiring. A prepared preview is not a completed write.

  1. If keys changed, preserve the old → new mapping. After the onekey-i18n PR is merged

and released, step 8's yarn i18n:pull is committed and code migration succeeds,

prepare the old-key cleanup

list and ask whether to delete it. Translation confirmation does not authorize

deletion; keep old keys unless the user explicitly approves that deletion scope.

Code usage

New keys use semantic_key__title, __action, __desc or __msg (backend error

identifiers keep error__service_*_error); onekey-i18n enforces the same pattern.

Legacy mapping: stored global::contact_us → JSON global.contact_us → enum

ETranslations.global_contact_us.

Use useIntl().formatMessage({ id: ETranslations.some_key }) during React rendering,

or appLocale.intl at call time outside React. Do not cache translated text in

module-level constants; keep memo/callback dependencies responsive to locale changes.

For yarn i18n:add compatibility, see single-key commands.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.