← スキル一覧に戻る

1k-i18n
by OneKeyHQ
1k-i18nは、ブロックチェーン技術を活用したソリューション開発を支援するスキルです。スマートコントラクトと分散システム構築をサポートします。
⭐ 2,181🍴 470📅 2026年1月23日
ユースケース
📜
スマートコントラクト開発
スマートコントラクトの作成とデプロイを効率化。
👛
ウォレット連携
暗号資産ウォレットとの連携を実装。
🔎
トランザクション分析
ブロックチェーントランザクションを分析・追跡。
SKILL.md
name: 1k-i18n description: Internationalization and translation guidelines for OneKey. Use when adding text strings, using translations, or working with locales. Triggers on i18n, translation, locale, intl, formatMessage, ETranslations, language, text. allowed-tools: Read, Grep, Glob, Bash
OneKey Internationalization (i18n) Guidelines
Translation Management - CRITICAL RESTRICTIONS
ABSOLUTELY FORBIDDEN (These files are AUTO-GENERATED):
- ❌ NEVER modify
@onekeyhq/shared/src/locale/enum/translations.ts- Will be overwritten and break i18n system - ❌ NEVER modify locale JSON files in
@onekeyhq/shared/src/locale/json/*- Managed by external translation system - ❌ NEVER hardcode text strings in components - ALWAYS use translation keys
- ❌ NEVER add translation keys directly to enum files - Use proper workflow
CONSEQUENCES OF VIOLATION:
- Translation system corruption
- Loss of translation work
- Build failures in i18n pipeline
- Breaking localization for international users
Using Translations
- Use
useFormatMessageorformatMessagefunctions for displaying translated text - Define new translation keys in the appropriate modules
- Always use translation keys instead of hardcoding text strings
- Follow the established pattern for translation keys:
namespace__action_or_description
Updating Translation Keys
- Direct translation from design specs: Update i18n directly based on design spec annotations without searching existing translation keys
- Run
yarn fetch:localeto pull the latest translation keys from the remote system - This command automatically updates
@onekeyhq/shared/src/locale/enum/translations.tswith new translation enums - For design spec translation keys like
prime::restore_purchases, convert to code format:- Replace
::with_(underscore) - Use the enum:
ETranslations.prime_restore_purchases - In component code:
{intl.formatMessage({ id: ETranslations.prime_restore_purchases, })}
- Replace
Locale Handling
- The system uses automatic locale detection with fallbacks
- Default locale fallback chain is implemented in
getDefaultLocale.ts - Respect platform-specific locale handling (web, native, desktop, extension)
Code Examples
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 Key Naming Pattern
namespace__action_description
Examples:
- global__confirm
- global__cancel
- swap__select_token
- wallet__create_wallet
- settings__dark_mode
スコア
総合スコア
90/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
✓説明文
100文字以上の説明がある
+10
✓人気
GitHub Stars 1000以上
+15
✓最近の活動
1ヶ月以内に更新
+10
✓フォーク
10回以上フォークされている
+5
○Issue管理
オープンIssueが50未満
0/5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
レビュー
💬
レビュー機能は近日公開予定です


