Skip to content

feat(i18n): add consolidated translation keys for strategy components#1375

Merged
tinkle-community merged 2 commits intoNoFxAiOS:mainfrom
xsa-dev:feat/i18n-consolidation-patch
Feb 9, 2026
Merged

feat(i18n): add consolidated translation keys for strategy components#1375
tinkle-community merged 2 commits intoNoFxAiOS:mainfrom
xsa-dev:feat/i18n-consolidation-patch

Conversation

@xsa-dev
Copy link
Contributor

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

Summary

This PR adds 275+ consolidated translation keys for 8 strategy components, supporting 3 languages (en, zh, es).

What This PR Does

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

    • 8 translation sections (coinSource, gridConfig, gridRisk, riskControl, promptSections, indicator, publishSettings, chartTabs)
    • All keys in en + zh + es
    • Pre-aggregated exports: zhStrategy, enStrategy, esStrategy
  2. Purpose: Centralize scattered i18n strings currently inline in 8 component files

Why This Matters

Current Problem: 8 components use scattered { zh: '...', en: '...' } pattern:

// Current anti-pattern in 8 files
const labels = {
  key: { zh: '中文', en: 'English' },
}
{t('key')[language]}

Solution: Centralized translations:

// NEW: Use centralized t('key', language)
import { coinSource } from 'i18n/strategy-translations'
t(coinSource.sourceType, language)

Components to Migrate (Future Work)

Component Current Pattern Status
CoinSourceEditor.tsx { zh, en } objects Ready for migration
GridRiskPanel.tsx { zh, en } objects Ready for migration
RiskControlEditor.tsx { zh, en } objects Ready for migration
GridConfigEditor.tsx { zh, en } objects Ready for migration
PromptSectionsEditor.tsx { zh, en } objects Ready for migration
IndicatorEditor.tsx { zh, en } objects Ready for migration
PublishSettingsEditor.tsx { zh, en } objects Ready for migration
ChartTabs.tsx { zh, en } objects Ready for migration

Related PRs

This PR complements #1343 by adding es translations for strategy components.

Next Steps

After this PR merges:

  1. Migrate each component to use t('key', language) pattern
  2. Remove scattered { zh, en } objects from component files
  3. Run Playwright tests to verify all languages work

Stats

  • Files Changed: 1
  • Lines Added: ~300
  • Translation Keys: 275+
  • Languages: 3 (en, zh, es)

- 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
- 275+ translation keys from 8 strategy components
- 3 languages: English, Chinese, Spanish
- Ready for integration into translations.ts
- Pre-aggregated exports for zhStrategy, enStrategy, esStrategy

Related to PR NoFxAiOS#1343 (maker95) and NoFxAiOS#1374 (xsa-dev)
@xsa-dev
Copy link
Contributor Author

xsa-dev commented Feb 8, 2026

@tangmengqiu @hzb1115 This PR adds 275+ consolidated translation keys for 8 strategy components (en+zh+es). It's a prerequisite for the component migration work that will consolidate scattered i18n strings.

What's in this PR:

  • web/src/i18n/strategy-translations.ts with 8 sections (coinSource, gridConfig, gridRisk, riskControl, promptSections, indicator, publishSettings, chartTabs)
  • All keys in 3 languages (en, zh, es)

Next steps after merge:

  • Migrate 8 components to use t('key', language) pattern
  • Remove scattered { zh, en } objects from component files
  • Run Playwright tests to verify all languages work

Related PRs: #1343 (es language), #1374 (zh TraderConfigModal)

Please review when you have time. This unblocks the i18n consolidation work. Thanks!

@xsa-dev
Copy link
Contributor Author

xsa-dev commented Feb 8, 2026

Hi @tangmengqiu and @hzb1115!

This PR is blocking the i18n refactor for 8 strategy components. Once merged, we can proceed with migrating:

  • CoinSourceEditor.tsx
  • GridRiskPanel.tsx
  • RiskControlEditor.tsx
  • GridConfigEditor.tsx
  • PromptSectionsEditor.tsx
  • IndicatorEditor.tsx
  • PublishSettingsEditor.tsx
  • ChartTabs.tsx

The consolidation file is ready and tested. Could you please review and merge when convenient?

Thank you!

@tinkle-community tinkle-community merged commit 4c525c1 into NoFxAiOS:main Feb 9, 2026
1 check passed
Hansen1018 pushed a commit to Hansen1018/nofx that referenced this pull request Mar 11, 2026
…NoFxAiOS#1375)

* feat(i18n): add 42 translation keys for TraderConfigModal

- 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

* feat(i18n): add consolidated translation keys (en + zh + es)

- 275+ translation keys from 8 strategy components
- 3 languages: English, Chinese, Spanish
- Ready for integration into translations.ts
- Pre-aggregated exports for zhStrategy, enStrategy, esStrategy

Related to PR NoFxAiOS#1343 (maker95) and NoFxAiOS#1374 (xsa-dev)
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.

2 participants