Skip to content

feat(i18n): multi-language support and Language preferences dropdown - #54

Merged
mcoliver merged 4 commits into
mainfrom
feature/language-i18n-support
Sep 27, 2026
Merged

mcoliver merged 4 commits into
mainfrom
feature/language-i18n-support

Conversation

@mcoliver

Copy link
Copy Markdown
Collaborator

Summary

Addresses and resolves #20 by implementing internationalization (i18n/l10n) and a Language selection dropdown in OpenUTV Preferences.

Key Changes

  1. UTV Preferences (General Tab):

    • Added a Language dropdown in the General preferences tab (RvPreferences.ui for both Qt6 and Qt5).
    • Supported options:
      • System Default ("" / "system")
      • English (en)
      • Español (Spanish) (es)
      • Français (French) (fr)
      • Deutsch (German) (de)
      • Italiano (Italian) (it)
      • 日本語 (Japanese) (ja)
      • 한국어 (Korean) (ko)
      • 简体中文 (Simplified Chinese) (zh_CN / zh)
    • Preferences are persisted in RvSettings under group "General" / "language".
    • On change, displays an informational prompt alerting the user to restart OpenUTV for all changes to take full effect.
  2. Application Startup Translation (main.cpp):

    • In src/bin/nsapps/UTV/main.cpp and src/bin/apps/rv/main.cpp, check RvSettings for the saved user language preference prior to initialization.
    • If an explicit language is configured, loads :/translations/i18n_<language>.qm.
    • If unset or set to system default, falls back gracefully to ORIGINALLOCAL, LANG, or QLocale::system().
  3. Menu Translation Bridge (RvDocument.cpp):

    • Added translateMenuText() in RvDocument.cpp.
    • Strips leading alignment whitespace, translates the core menu text through qApp->translate("Menu", ...) (with QObject fallback), and re-attaches the prefix.
    • Translates all menus, submenus, actions, and popup items defined dynamically in Mu or Python.
  4. Toolbar & Tooltip Internationalization:

    • Wrapped tooltips in tr(...) across RvTopViewToolBar.cpp and RvBottomViewToolBar.cpp (Session Manager, Timeline, Annotation, Ghost, Hold, Play/Step controls, Stereo, Views, Channels, Display configuration).
  5. Catalogs & Resources:

    • Populated .ts and compiled .qm files for en, es, fr, de, it, ja, ko, zh, and zh_CN covering all major menu items, dialogs, preferences, and toolbar actions.
    • Registered all .qm files in src/lib/app/RvCommon/qrc/RvCommon.qrc.
    • Added generate_translations.py to regenerate and compile translation files cleanly with lrelease.

Closes #20

- Add Language selection dropdown to UTV Preferences dialog (General tab) supporting System Default, English, Spanish, French, German, Italian, Japanese, Korean, and Simplified Chinese
- Save and restore selected language in RvSettings (General/language)
- Load user language preference on startup before falling back to system locale
- Add translation bridge in RvDocument to translate script-generated menus, submenus, and actions via QTranslator
- Wrap toolbar action tooltips with tr() in RvTopViewToolBar and RvBottomViewToolBar
- Provide comprehensive translation catalogs (.ts and .qm) for en, es, fr, de, it, ja, ko, zh, and zh_CN
- Include all compiled translation resources in RvCommon.qrc

Closes #20

Signed-off-by: Michael Oliver <mcoliver@gmail.com>
…ion catalogs

- Implement dynamic runtime language switching without requiring application restart
- Add applyLanguage() to RvPreferences to hot-swap QTranslator and refresh open documents
- Add QEvent::LanguageChange handlers to RvPreferences, RvDocument, RvTopViewToolBar, and RvBottomViewToolBar
- Add comprehensive repository-wide string extractor and Google Translate pipeline in generate_translations.py
- Populate full 1,974 translations across French, Spanish, German, Italian, Japanese, Korean, and Chinese
- Persist translations_cache.json for offline deterministic regeneration

Signed-off-by: Michael Oliver <mcoliver@gmail.com>
… changeEvent

- Call QDialog::changeEvent instead of QMainWindow::changeEvent in RvPreferences
- Deliver QEvent::LanguageChange to open RvDocuments via sendEvent rather than direct private member access
- Merge duplicate changeEvent definition in RvDocument.cpp and remove redundant header declaration

Signed-off-by: Michael Oliver <mcoliver@gmail.com>
…slate

Signed-off-by: Michael Oliver <mcoliver@gmail.com>
@mcoliver
mcoliver merged commit cf05e83 into main Sep 27, 2026
9 checks passed
@mcoliver
mcoliver deleted the feature/language-i18n-support branch September 27, 2026 05:20
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.

feat: add i8n i10n language support

1 participant