con un clic
1k-i18n
// Internationalization — translations (ETranslations, useIntl, formatMessage) and locale management. NEVER modify auto-generated translation files.
// Internationalization — translations (ETranslations, useIntl, formatMessage) and locale management. NEVER modify auto-generated translation files.
Guide for integrating new DeFi modules or protocols (staking, lending, Earn, Borrow) into OneKey.
OneKey Trade/Swap/Market playbook for implementation, debugging, PR review, and validation. Always use when work touches Swap, Swap Pro, Market speed-swap, Private Send/incognito, DeFi/Earn funding handoffs into Trade/Swap/Limit, presets, limit orders, token selectors, providers, quotes, fees, slippage, history, pending status, Houdini, RocketX, LiFi, SWFT, Cow Limit, 交易, 兑换, 隐私发送, 限价, 预设, 报价, 手续费, 交易历史, or provider integration.
OneKey TradingView app bridge guide. Use when changing or debugging TradingView/WebView/iframe communication, chart URL params, kline/history/realtime messages, marks, Hyperliquid price scale, Perps SYMBOL_CHANGE, chart lines, order draft/cancel/drag-amend messages, FORCE_RECOVER_WS, or tradingview_* methods between the app repo and the chart repo. 适用于 TradingView 通信、图表 WebView 通信、K 线、perps 线、marks、消息桥排查。
OneKey Browser/Discovery module development guide. Use when changing 浏览器模块, Discovery browser, MultiTabBrowser, DApp browser, WebView tabs, bookmarks, history, browser search, URL risk detection, DApp connection, JSBridge, or in-app browser behavior.
Comprehensive PR code review for OneKey monorepo. Use when reviewing PRs, code changes, or diffs — covers security (secrets/PII leakage, supply-chain, AuthN/AuthZ), code quality (hooks, race conditions, null safety, concurrent requests), and OneKey-specific patterns (Fabric crashes, MIUI, BigNumber). Triggers on "review PR", "review this PR", "code review", "check this diff", "审查 PR", "代码审查", "review
Creates a Pull Request from current changes for OneKey app-monorepo. Use when user wants to create PR, submit changes, or merge feature branch. Handles branch creation, commit, push, and PR creation with conversation context extraction for code review AI.
| name | 1k-i18n |
| description | Internationalization — translations (ETranslations, useIntl, formatMessage) and locale management. NEVER modify auto-generated translation files. |
| allowed-tools | Read, Grep, Glob |
Guidelines for internationalization and translation management in OneKey.
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:
When updating an existing translation:
lokalise MCP if it is available in the current environment.yarn i18n:pull or yarn i18n:pull:keychain.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:
::.yarn i18n:search: searches pulled en_US.json, so legacy keys should be queried with ., while newer suffix-style keys should be queried with __.ETranslations member with _.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>
);
}
import { appLocale } from '@onekeyhq/shared/src/locale/appLocale';
import { ETranslations } from '@onekeyhq/shared/src/locale';
const message = appLocale.intl.formatMessage({
id: ETranslations.global__cancel,
});
yarn i18n:search "global.contact_us" or yarn i18n:search "address_book__action"global::contact_usyarn i18n:pullyarn i18n:add using the suffix-style underscore format{intl.formatMessage({ id: ETranslations.global_contact_us })}
semantic_key__type
Examples:
- send__title
- confirm_send__action
- enter_send_amount__desc
- transaction_failed__msg
For comprehensive i18n guidelines and examples, see i18n.md.
Topics covered:
| Purpose | File Path |
|---|---|
| Translation enum (auto-generated) | packages/shared/src/locale/enum/translations.ts |
| Locale JSON (auto-generated) | packages/shared/src/locale/json/ |
| App locale | packages/shared/src/locale/appLocale.ts |
| Default locale | packages/shared/src/locale/getDefaultLocale.ts |
/1k-date-formatting - Date formatting with locale support/1k-coding-patterns - General coding patterns