Skip to content

feat(i18n): Complete internationalization support for English and Simplified Chinese#4

Merged
hubo1989 merged 1 commit intomainfrom
i18n
Feb 4, 2026
Merged

feat(i18n): Complete internationalization support for English and Simplified Chinese#4
hubo1989 merged 1 commit intomainfrom
i18n

Conversation

@hubo1989
Copy link
Owner

@hubo1989 hubo1989 commented Feb 4, 2026

Summary

Add complete i18n (internationalization) support for ScreenTranslate with English and Simplified Chinese languages.

Changes

New Features

  • Language Selector: Added language picker in Settings > General section
    • System Default (follows macOS language, falls back to English)
    • English
    • 简体中文 (Simplified Chinese)
  • Real-time Language Switching: UI updates immediately when language is changed (no restart required)

Localization Files

  • Created en.lproj/Localizable.strings (~410 entries)
  • Created zh-Hans.lproj/Localizable.strings (~410 entries)
  • Covers: error messages, menu items, settings, preview window, history view, onboarding, etc.

Architecture

  • AppLanguage.swift: Language enum and LanguageManager singleton for runtime switching
  • L() helper function for localized string lookup from active bundle
  • LocalizedText SwiftUI view that auto-refreshes on language change
  • Menu bar auto-rebuilds when language changes
  • Settings view refreshes via notification observer

Bug Fixes

  • Fixed AttributeGraph: cycle detected crash by deferring permission checks
  • Fixed PaddleOCRChecker SIGABRT by making availability check async/non-blocking

Testing

  1. Open Settings and change language in General section
  2. Verify all UI text updates immediately
  3. Verify menu bar items update
  4. Switch back and forth between languages

… Simplified Chinese

- Add .lproj directory structure (en.lproj, zh-Hans.lproj)
- Create comprehensive Localizable.strings for both languages (~410 entries)
- Add LanguageManager for runtime language switching
- Add AppLanguagePicker in Settings for user language selection
- Replace hardcoded strings with L() localization helper
- Fix PaddleOCRChecker to use async availability check (prevents SIGABRT)
- Fix AttributeGraph cycle in SettingsView by deferring permission checks
- Menu bar rebuilds automatically when language changes
- Settings view refreshes in real-time on language change
@hubo1989 hubo1989 merged commit 9863d3d into main Feb 4, 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