1k-i18n
Handles locale management and translation integration without modifying auto-generated files.
Install
mkdir -p .claude/skills/1k-i18n && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4196" && unzip -o skill.zip -d .claude/skills/1k-i18n && rm skill.zipInstalls to .claude/skills/1k-i18n
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Internationalization — translations (ETranslations, useIntl, formatMessage) and locale management. NEVER modify auto-generated translation files.Key capabilities
- →Manage translation keys using ETranslations
- →Implement locale-aware components with useIntl
- →Sync translation files via yarn i18n:pull
- →Add new translation keys using yarn i18n:add
How it works
The skill utilizes the react-intl library and generated ETranslations enums to map semantic keys to localized strings, ensuring consistency across the application.
Inputs & outputs
When to use 1k-i18n
- →Adding new translation keys
- →Implementing useIntl hooks
- →Configuring locale management
About this skill
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
- Never manually edit generated locale JSON,
translations.tsorlocaleJsonMap.ts. - Before writing or reviewing English source copy, read
.skillshare/skills/ui-copy/SKILL.mdand follow its rules. - Runtime translations come from bundled locale JSON (
localeLoaders.ts). Deleting a key leaves released app bundles unchanged; later pulls and builds receive it. - Prefer existing generic keys when meaning, placeholders, capitalization and UI role match. Do not duplicate legacy keys for naming consistency or change shared copy unless explicitly in scope.
- Translate every locale listed in the draft; preserve ICU placeholders/tags and product tone. Do not use English as a placeholder for untranslated languages.
- Use compact summaries, local search and relevant source slices; do not load entire 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
- Reads use the read-only
ONEKEY_I18N_TOKENthat the yarn scripts load from 1Password (yarn op). Opening onekey-i18n PRs uses your owngh auth loginidentity, which needs write access toOneKeyHQ/onekey-i18n. No checkout of onekey-i18n is needed.
Workflow
Paths are relative to the repository root; use .tmp/i18n/<task>/ for <dir>.
-
Pull before selecting or translating copy, in both modes:
yarn i18n:sync --out <dir>/sync.json. It pulls the latestapprelease. Preserve unknown local generated changes if the script blocks; use recovery guidance. -
Locate the module with
rg, then runyarn i18n:workflow scan --mode <mode> --sync <dir>/sync.json --module <path> --out <dir>/draft.json. Repeat--modulefor related copy. For explicit updates to already complete keys, add--include-completeand limit edits to the requested keys/languages. -
Read
draft.json.summary.jsonand relevant code. Search reusable keys withyarn i18n:search. Chooseupsert/reuse orignore(with a reason); fill missing or requested translations using the patch format. Useinspect --file <draft>to check remaining work. -
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. -
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.
-
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. -
The onekey-i18n PR needs its CI and one reviewer. Report its link.
-
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. -
If keys changed, preserve the old → new mapping. After the onekey-i18n PR is merged and released, step 8's
yarn i18n:pullis 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.
When not to use it
- →Do not modify auto-generated translation files directly
Prerequisites
Limitations
- →Cannot manually edit auto-generated locale files
- →Requires Lokalise for source translation updates
How it compares
This approach enforces a strict separation between source translation management in Lokalise and local code usage, preventing manual corruption of generated JSON files.
Compared to similar skills
1k-i18n side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| 1k-i18n (this skill) | 1 | 4mo | No flags | Intermediate |
| i18n-expert | 2 | 10mo | Review | Intermediate |
| i18n-localization | 0 | 5mo | Review | Intermediate |
| localize | 0 | 7mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by OneKeyHQ
View all by OneKeyHQ →You might also like
i18n-expert
daymade
This skill should be used when setting up, auditing, or enforcing internationalization/localization in UI codebases (React/TS, i18next or similar, JSON locales), including installing/configuring the i18n framework, replacing hard-coded strings, ensuring en-US/zh-CN coverage, mapping error codes to localized messages, and validating key parity, pluralization, and formatting.
i18n-localization
Harmitx7
Internationalization (i18n) and localization mastery. Abstracting hardcoded strings, managing JSON/YAML translation dictionaries, bidirectional routing (RTL support for Arabic/Hebrew), Pluralization algorithms, date/currency formatting, and SSR locale detection in Next.js/React. Use when preparing a
localize
aladicf
Plan, implement, or improve an internationalization and localization strategy for UI content, formatting, and regional adaptation. Use when the user asks to add i18n, localize, translate, support multiple languages, handle regional formats, manage locale switching, or build a multilingual product.
sif-intl
navikt
Mønster for typesikker i18n (nb/nn) i apper og pakker — implementering, parametersjekk og meningssjekk.
skills
jralvarenga
Package map and reading order for Better Translate product skills.
nextjs-developer
zenobi-us
Expert Next.js developer mastering Next.js 14+ with App Router and full-stack features. Specializes in server components, server actions, performance optimization, and production deployment with focus on building fast, SEO-friendly applications.