Skip to content

Conversation

@AndersHsueh
Copy link

Summary

  • Adds comprehensive internationalization (i18n) support to the desktop app
  • Supports 6 languages: English, Simplified Chinese, Japanese, Korean, French, Spanish
  • Includes language switcher in Settings with persistent preference
  • Fixes translation loading issue in packaged Windows app

Changes

Dependencies

  • Added react-i18next@^15.2.1
  • Added i18next@^24.2.1

New Files

  • apps/desktop/src/renderer/i18n/config.ts - i18n initialization and language switching
  • apps/desktop/src/main/utils/locale.ts - Main process locale utilities with system language detection
  • apps/desktop/public/locales/{lang}/translation.json - 6 complete translation files (232 lines each)

Modified Files

  • All user-facing components internationalized:
    • Home.tsx - Main page with example prompts
    • Execution.tsx - Task execution page
    • History.tsx - Task history page
    • SettingsDialog.tsx - Settings with language selector
    • Header.tsx - Navigation header
    • Sidebar.tsx - Navigation sidebar
    • TaskInputBar.tsx - Task input component
  • IPC handlers in src/main/ipc/handlers.ts for locale persistence
  • Preload script in src/preload/index.ts to expose locale APIs
  • Vite config for proper module resolution
  • Package.json extraResources to bundle translations

Features

  • ✅ Automatic language detection from system locale
  • ✅ Manual language switching via Settings UI
  • ✅ Persistent language preference across app restarts
  • ✅ Graceful fallback to English if translation unavailable
  • ✅ Works in both development and production builds
  • ✅ All UI text internationalized (232 translation keys per language)

Testing

  • Build succeeds with pnpm lint (TypeScript checks pass)
  • Translation files correctly packaged in app resources via extraResources
  • Language switching works in Settings dialog
  • Language preference persists across restarts via electron-store
  • Fallback to English works for missing translations
  • Dev mode loads translations from Vite dev server
  • Production mode loads translations from resources directory

Technical Implementation

Translation Loading Strategy

  • Development: Vite dev server serves from /locales/{lang}/translation.json
  • Production: Loads from file:///{resourcesPath}/locales/{lang}/translation.json
  • Smart detection via window.accomplish?.getResourcesPath API

Locale Detection Flow

  1. Check saved preference in electron-store
  2. If none, detect system language via app.getLocale()
  3. Map system locale to supported language via LOCALE_MAP
  4. Fallback to English

Architecture

  • Main process: Locale persistence + system language detection
  • Renderer process: i18n initialization + UI translations
  • IPC bridge: locale:get-initial, locale:set, app:resources-path

Notes

This addresses the issue from PR #32 (Revert internationalization support). The previous implementation was reverted due to translation loading failures in packaged apps. This PR includes comprehensive fixes:

  1. Proper resource packaging: Translation files bundled via extraResources in package.json
  2. IPC for resources path: Added app:resources-path handler to expose process.resourcesPath to renderer
  3. Smart path resolution: i18n config detects environment and uses correct protocol (HTTP vs file://)
  4. Production verification: Tested in Windows packaged build (see I18N_FIX_VERIFICATION.md)

Supported Languages

  • 🇬🇧 English (en)
  • 🇨🇳 Simplified Chinese (zh-CN)
  • 🇯🇵 Japanese (ja)
  • 🇰🇷 Korean (ko)
  • 🇫🇷 French (fr)
  • 🇪🇸 Spanish (es)

All translations are complete with identical structure.

🤖 Generated with Claude Code

AndersHsueh and others added 7 commits January 20, 2026 06:29
- Add Windows electron-builder configuration (NSIS and portable targets)
- Add Windows Node.js binary download support (x64 and ia32)
- Create Windows icon (.ico) from PNG with PowerShell script
- Update package scripts for Windows builds
- Remove Windows platform exclusions from build files
- Add AGENTS.md documentation for AI coding agents
- Configure npmRebuild and buildDependenciesFromSource flags
- Update .gitignore for Windows-specific files and temp directories
- Add react-i18next and i18next dependencies
- Implement i18n configuration with automatic locale detection
- Add translation files for 6 languages (en, zh-CN, ja, ko, fr, es)
- Internationalize all user-facing components
- Add language switcher in Settings dialog
- Add IPC handlers for locale persistence
- Fix translation loading in packaged app using extraResources
- Add locale utilities for system language detection
- Add GitHub Actions workflow to build Windows installer with i18n support
- Auto-create GitHub Release with NSIS installer
- Add download section in README.md for Windows+i18n version
- Support 6 languages: zh-CN, en, ja, ko, fr, es
chore(release): bump version to 0.2.4
…in (provider settings)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@AndersHsueh
Copy link
Author

PR #108 - Conflicts with upstream/main have been resolved\n\nWe have successfully resolved the merge conflicts between PR #108 and the latest main branch. The key resolutions include:\n\n1. Integrated i18n functionality with new provider settings system from main branch\n2. Maintained all internationalization features (6 languages support)\n3. Preserved Windows build support and other main branch features\n\nThe PR now includes both the internationalization features and all updates from the main branch. Ready for review.

@AndersHsueh AndersHsueh changed the title feat: add internationalization support with 6 languages FEAT: ADD INTERNATIONALIZATION SUPPORT WITH 6 LANGUAGES (CONFLICTS RESOLVED) Jan 20, 2026
AndersHsueh and others added 2 commits January 20, 2026 20:19
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@AndersHsueh
Copy link
Author

Updated PR #108 - New conflicts with upstream/main have been resolved.\n\nWe have successfully resolved the new merge conflicts that appeared after recent changes to upstream/main. The key resolutions include:\n\n1. Updated package.json with latest build scripts and electron-builder configuration\n2. Maintained all internationalization features (6 languages support)\n3. Preserved Windows build support functionality\n4. Kept both i18n and provider settings systems integrated\n\nThe PR now includes all changes from upstream/main plus the complete i18n functionality. Ready for review.

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