Skip to content

feat: add Simplified Chinese (zh-CN) internationalization#1044

Open
superpickyapp wants to merge 1 commit into
CyberTimon:mainfrom
superpickyapp:main
Open

feat: add Simplified Chinese (zh-CN) internationalization#1044
superpickyapp wants to merge 1 commit into
CyberTimon:mainfrom
superpickyapp:main

Conversation

@superpickyapp
Copy link
Copy Markdown

Summary

This PR adds full Simplified Chinese (简体中文) support to RapidRAW using react-i18next, while keeping English as the default language. The language can be switched instantly from the Settings panel without restarting the app, and the preference is persisted in AppSettings.

What's included

  • i18n framework: Added i18next + react-i18next, configured in src/i18n.ts with en as default and zh-CN as the second locale
  • Translation files: src/locales/en/translation.json and src/locales/zh-CN/translation.json — covering all namespaces: app, metadata, library, editor, adjustments, crop, export, presets, ai, settings, tooltips, modals, masks
  • Language persistence: Added language: Option<String> field to Rust AppSettings struct; language is loaded on startup and saved on change
  • Settings UI: Language dropdown in Settings panel (English / 简体中文), switches instantly via i18n.changeLanguage()
  • Full coverage: All hardcoded English strings replaced with t() calls across 50+ components — including panels, modals, context menus, adjustment controls, mask type names, waveform modes, color labels, and more

Architecture notes

  • Module-level constant arrays that contain display labels (e.g. mask types, backend options) use a nameKey / labelKey pattern — the key is stored in the array and t(key) is called at render time, so language switches are reactive
  • Native macOS menu bar (File/Edit/Window) follows the OS system language — this is intentional and consistent with how other macOS apps behave
  • The name field on MaskType is preserved for backwards compatibility; nameKey is the new field used for translated display

How to test

  1. Build and run the app
  2. Open Settings → scroll to Language → select 简体中文
  3. The entire UI should switch to Chinese immediately
  4. Restart the app — language preference is restored from saved settings
  5. Switch back to English — everything returns to English

I hope this can be useful to Chinese-speaking users of RapidRAW. Happy to address any feedback or make adjustments to fit the project's conventions.

🤖 Generated with Claude Code

Implement complete internationalization using react-i18next across the entire app. All UI strings in components, modals, panels, context menus, and adjustment controls are now translated. Language selection persists via AppSettings and switches instantly without restart.

- Add i18next framework with en and zh-CN locale files
- Add language field to AppSettings (Rust + TypeScript)
- Replace hardcoded strings in 50+ components with t() calls
- Translate mask type names, color labels, waveform modes, curve menus
- Support dynamic strings (mask default names, copy/inverted suffixes)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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