OneKey i18n and Lokalise workflow for searching, adding, updating, pulling, and using translation keys. Verify the target project and full locale coverage; never edit generated translation files.
61
74%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
Fix and improve this skill with Tessl
tessl review fix ./.skillshare/skills/1k-i18n/SKILL.mdGuidelines 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:
Search locally and remotely before creating a key. Reuse a key only when its meaning, placeholders, and UI context match.
For any Lokalise create or update:
yarn op is the default;
keychain and oenv variants are supported alternatives.yarn i18n:pull,
yarn i18n:pull:keychain, or yarn i18n:pull:oenv.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_usFor 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__actionQuery 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 _.For any task that creates or updates a translation:
GET /projects/{project_id} and confirm the returned project name
and ID match the intended target.GET /projects/{project_id}/languages and record its exact
lang_iso values.yarn i18n:add for a missing key. It only creates en_US and optional
zh_CN source translations; it does not complete the remaining locales.ETranslations member in code and validate placeholder
consistency.Do not silently skip a repository locale because the target project uses a
different code format. Map repository locale names to the project's configured
lang_iso values. If the project genuinely lacks a required language, stop
before upload and report the mismatch.
The completion report must state the verified project name/ID, covered locale set, pull command used, generated-file scope, and any unrelated keys brought in by the pull. Review code changes separately from generated locale changes.
Read i18n.md before performing any remote Lokalise
mutation or i18n:pull. It contains the project preflight, current 19-locale
set, translation-record update flow, and generated-diff verification.
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_us, in that verified projectyarn i18n:add using the suffix-style underscore formaten_US/zh_CN{intl.formatMessage({ id: ETranslations.global_contact_us })}semantic_key__type
Examples:
- send__title
- confirm_send__action
- enter_send_amount__desc
- transaction_failed__msgFor comprehensive i18n guidelines and the end-to-end Lokalise workflow, 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 |
| Lokalise add script | development/scripts/i18n/i18n-add.js |
| Lokalise pull script | development/scripts/i18n/i18n-pull.js |
/1k-coding-patterns - Date formatting with locale support/1k-coding-patterns - General coding patterns518bbeb
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.