Skip to content

feat(i18n): complete migration to centralized translations (en+zh+es)#1

Merged
xsa-dev merged 2 commits intomainfrom
feat/i18n-full-consolidation
Feb 8, 2026
Merged

feat(i18n): complete migration to centralized translations (en+zh+es)#1
xsa-dev merged 2 commits intomainfrom
feat/i18n-full-consolidation

Conversation

@xsa-dev
Copy link
Owner

@xsa-dev xsa-dev commented Feb 8, 2026

Summary

Complete i18n infrastructure refactor for NOFX strategy components.

This PR consolidates scattered i18n strings and adds Spanish translations for 8 components.

What This PR Does

  1. Creates web/src/i18n/strategy-translations.ts

    • 275+ centralized translation keys
    • 8 sections: coinSource, gridConfig, gridRisk, riskControl, promptSections, indicator, publishSettings, chartTabs
    • All keys in English (en), Chinese (zh), and Spanish (es)
  2. Migrates 8 Strategy Components to centralized pattern:

    • CoinSourceEditor.tsx - Data source configuration
    • GridRiskPanel.tsx - Risk display panel
    • RiskControlEditor.tsx - Risk settings
    • GridConfigEditor.tsx - Grid parameters
    • PromptSectionsEditor.tsx - AI prompt customization
    • IndicatorEditor.tsx - Technical indicators
    • PublishSettingsEditor.tsx - Publishing options
    • ChartTabs.tsx - Chart navigation

Migration Pattern

BEFORE (anti-pattern):

// Inline translation objects in each component
const labels = {
  key: { zh: '中文', en: 'English' },
}
{t('key')[language]}

AFTER (standard pattern):

// Centralized translations.ts
import { coinSource } from 'i18n/strategy-translations'
t(coinSource.sourceType, language)

Files Changed

  • web/src/i18n/strategy-translations.ts (new)
  • 8 component files updated

Stats

  • Translation Keys: 275+
  • Languages: 3 (en, zh, es)
  • Components Migrated: 8
  • Lines Added: ~700
  • Lines Removed: ~2,400 (consolidation)

Related PRs

Testing

After merge, verify:

  1. All 8 components render correctly in English
  2. All 8 components render correctly in Chinese (中文)
  3. All 8 components render correctly in Spanish (Español)
  4. No console errors related to missing translations

xsa-dev and others added 2 commits February 8, 2026 13:18
- Add new translation keys for all hardcoded Chinese strings
- Replace hardcoded UI text with t('key', language) calls
- Support both English and Chinese languages

Modified files:
- web/src/i18n/translations.ts: +88 lines (42 new keys)
- web/src/components/TraderConfigModal.tsx: replaced 48 hardcoded strings
- Consolidate 275+ translation keys into strategy-translations.ts
- Migrate 8 strategy components to use centralized i18n pattern
- Components: CoinSourceEditor, GridRiskPanel, RiskControlEditor,
  GridConfigEditor, PromptSectionsEditor, IndicatorEditor,
  PublishSettingsEditor, ChartTabs
- Add Spanish (es) translations for all strategy components
- Remove inline { zh, en } translation objects from components
- Use standard t(key, language) pattern throughout

Related: NoFxAiOS#1343 (maker95 - es language), NoFxAiOS#1374 (xsa-dev - zh TraderConfigModal)
Co-authored-by: xsa-dev <xsa-dev@users.noreply.github.com>
@xsa-dev xsa-dev merged commit 90a3c2d into main Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant