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.zip

Installs 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.
145 charsno explicit “when” trigger
Intermediate

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

You give it
Translation key identifier
You get back
Localized string in the application

When to use 1k-i18n

  • Adding new translation keys
  • Implementing useIntl hooks
  • Configuring locale management

About this skill

Internationalization (i18n)

Guidelines for internationalization and translation management in OneKey.

Critical Restrictions

ABSOLUTELY FORBIDDEN (auto-generated files):

// ❌ NEVER modify these files - they are AUTO-GENERATED
// @onekeyhq/shared/src/locale/enum/translations.ts
// @onekeyhq/shared/src/locale/json/*.json

// ❌ NEVER hardcode text strings
<Text>Confirm</Text>

// ✅ CORRECT - Always use translation keys
import { ETranslations } from '@onekeyhq/shared/src/locale';
intl.formatMessage({ id: ETranslations.global__confirm })

Consequences of violation:

  • Translation system corruption
  • Loss of translation work
  • Build failures in i18n pipeline
  • Breaking localization for international users

Existing Keys First

When updating an existing translation:

  • Do not edit generated locale files directly.
  • Update the source translation in Lokalise:
    • Use the lokalise MCP if it is available in the current environment.
    • Otherwise use Lokalise Web.
  • After the source change, sync locally with yarn i18n:pull or yarn i18n:pull:keychain.

Key Shape Mapping

The same translation may appear in 3 different shapes depending on where you look:

Lokalise / MCP source key:     global::contact_us
Pulled local JSON key:         global.contact_us
Generated enum member:         ETranslations.global_contact_us

For newer suffix-style keys, Lokalise and local JSON usually match:

Lokalise / MCP source key:     address_book__action
Pulled local JSON key:         address_book__action
Generated enum member:         ETranslations.address_book__action

Query guidance:

  • Lokalise / MCP: prefer the exact source key. Legacy namespaced keys often use ::.
  • Local yarn i18n:search: searches pulled en_US.json, so legacy keys should be queried with ., while newer suffix-style keys should be queried with __.
  • Code usage: refer to the generated ETranslations member with _.

Quick Reference

Using Translations in Components

import { useIntl } from 'react-intl';
import { ETranslations } from '@onekeyhq/shared/src/locale';

function MyComponent() {
  const intl = useIntl();

  return (
    <SizableText>
      {intl.formatMessage({ id: ETranslations.global__confirm })}
    </SizableText>
  );
}

Using formatMessage Outside Components

import { appLocale } from '@onekeyhq/shared/src/locale/appLocale';
import { ETranslations } from '@onekeyhq/shared/src/locale';

const message = appLocale.intl.formatMessage({
  id: ETranslations.global__cancel,
});

Translation Workflow

  1. Search first
    • Local search: yarn i18n:search "global.contact_us" or yarn i18n:search "address_book__action"
    • Lokalise / MCP: try the exact source key, such as global::contact_us
  2. If the key already exists, update it in Lokalise and then run yarn i18n:pull
  3. If it is a new key, add it via yarn i18n:add using the suffix-style underscore format
  4. Use in code:
    {intl.formatMessage({ id: ETranslations.global_contact_us })}
    

New Key Naming Pattern

semantic_key__type

Examples:
- send__title
- confirm_send__action
- enter_send_amount__desc
- transaction_failed__msg

Detailed Guide

For comprehensive i18n guidelines and examples, see i18n.md.

Topics covered:

  • Translation management restrictions
  • Using translations in components
  • Translation key naming conventions
  • Locale handling and fallbacks
  • Code examples
  • Workflow summary

Key Files

PurposeFile Path
Translation enum (auto-generated)packages/shared/src/locale/enum/translations.ts
Locale JSON (auto-generated)packages/shared/src/locale/json/
App localepackages/shared/src/locale/appLocale.ts
Default localepackages/shared/src/locale/getDefaultLocale.ts

Related Skills

  • /1k-coding-patterns - Date formatting with locale support
  • /1k-coding-patterns - General coding patterns

When not to use it

  • Do not modify auto-generated translation files directly

Prerequisites

yarn

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.

SkillInstallsUpdatedSafetyDifficulty
1k-i18n (this skill)11moNo flagsIntermediate
i18n-expert26moReviewIntermediate
i18n-localization01moReviewIntermediate
localize03moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

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.

25

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

00

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.

00

sif-intl

navikt

Mønster for typesikker i18n (nb/nn) i apper og pakker — implementering, parametersjekk og meningssjekk.

00

skills

jralvarenga

Package map and reading order for Better Translate product skills.

00

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.

328531

Search skills

Search the agent skills registry