Skip to content

Complete language support to all GUI tabs (#876)#877

Open
macumber wants to merge 21 commits into
developfrom
ski90moo-develop
Open

Complete language support to all GUI tabs (#876)#877
macumber wants to merge 21 commits into
developfrom
ski90moo-develop

Conversation

@macumber
Copy link
Copy Markdown
Collaborator

Duplicates #873 from @Ski90Moo on internal branch for CI

Ski90Moo and others added 21 commits May 30, 2026 22:18
Wraps all user-facing string literals in the three Schedules sub-tabs
(Schedule Sets, Schedules, Other Schedules) with Qt tr() calls to enable
multi-language support, addressing issue #680.

Files modified:
- ScheduleSetInspectorView: 12 section/field labels
- SchedulesView: 23 strings across ScheduleTabContent, ScheduleTabDefault,
  NewProfileView, DefaultScheduleDayView, SpecialScheduleDayView,
  ScheduleRuleView, ScheduleRulesetNameWidget, MonthView
- ScheduleFileInspectorView: 15 field labels and combo box items
- ScheduleDialog: 10 strings including runtime-appended values
- ScheduleDayView + .hpp: 6 button/label strings; adds
  Q_DECLARE_TR_FUNCTIONS to 3 QGraphicsItem subclasses for tooltip tr()
- ScheduleCompactInspectorView: 2 labels
- ScheduleConstantInspectorView: 2 labels
- ScheduleOthersController: 1 error message
- ScheduleOthersView: 3 sidebar type names via QCoreApplication::translate()
- MainRightColumnController: 9 sidebar nav strings via tr().toStdString()

Adds Spanish translations for all new strings to OpenStudioApp_es.ts.
Day-of-week single-letter buttons S/T marked unfinished pending source-level
disambiguation (tr("S", "Sunday") etc.).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
)

Wraps user-facing string literals with tr() across all major tabs and
adds a complete Spanish (es) translation file as proof of concept for
multi-language support, addressing issue #680.

Tabs covered: Site/Weather Data, Construction Sets, Materials, Schedules,
Thermal Zones, Space Types, Loads, Facility, HVAC Systems, Inspector panel
IDD fields, Output Variables (1051 names), Simulation Settings, Measures,
Run Simulation, and Results Summary.

Key patterns established:
- tr() for compile-time strings in Q_OBJECT classes
- QCoreApplication::translate(IDD/OutputVariables/TaxonomyCategories)
  for runtime strings from the OpenStudio SDK and taxonomy.xml
- addItem(tr(Display), EnglishData) + currentData() for model-bound
  combo boxes where SDK values must stay in English
- Bilingual display format for IDD fields and output variable names so
  engineers can cross-reference EnergyPlus documentation without switching
  the application language

translations/OpenStudioApp_es.ts grows from ~200 to 3017 entries.
New languages only require a new .ts file with no further C++ changes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds Translation_GTest.cpp to the OpenStudioApp test target, covering:

Translation_ts suite (no build-path dependency, uses .ts source file):
- ValidXml: verifies OpenStudioApp_es.ts parses as well-formed XML
- HasExpectedContexts: checks all new translation contexts are present
  (IDD, OutputVariables, TaxonomyCategories, SimSettingsView, RunView, etc.)
- TranslationCountIsSubstantial: guards against accidental file truncation
- IddContextHasEntries: IDD context has >50 field-name translations
- OutputVariablesContextHasEntries: OutputVariables context has >=1000 entries
- TaxonomyCategoriesContextHasEntries: taxonomy categories are present

Translation_qm suite (requires compiled .qm, skipped gracefully if absent):
- QmFileLoads: QTranslator::load() succeeds for OpenStudioApp_es.qm
- SpanishSimSettingsStringsTranslated: spot-checks Simulation Settings labels
- SpanishRunViewStringsTranslated: spot-checks Run Simulation labels
- TaxonomyCategoriesTranslated: spot-checks library sidebar category names
- OutputVariablesSampleTranslated: spot-checks output variable name translations
- EnglishStringsReturnedWithoutTranslator: verifies English fallback when no
  QTranslator is installed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…680)

- Expand language support from Spanish proof-of-concept to 18 languages:
  Arabic, Catalan, German, Greek, Persian, French, Hebrew, Hindi, Indonesian,
  Italian, Japanese, Korean, Polish, Portuguese, Turkish, Vietnamese,
  Simplified Chinese (new), plus Spanish
- Add Portuguese, Korean, Turkish, Indonesian to Preferences > Language menu
  with proper QAction wiring in MainMenu.cpp/.hpp
- Fix RTL layout direction: setLayoutDirection(RightToLeft) for ar/fa/he,
  reset to LeftToRight when switching away from RTL languages
- Enable Arabic in Language menu (was commented out)
- Translate ~7,000 strings per language via Claude Haiku Batches API:
  UI strings, IDD field names, and OutputVariable display names
- Fix apply_translations counter-shift bug: use same regex pattern as
  extract_unfinished so XML comments and <location/> tags don't cause
  wrong translations to be assigned to wrong source strings
- Escape HTML entities (bare <, >, & and named entities like &aacute;)
  in all translation files to produce valid XML for lrelease
- Add batch translation scripts: translate_all_languages.py,
  translate_new_languages.py, retranslate_stubborn.py, recover_batches.py

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Wrap hardcoded strings in GeometryEditorView.cpp (Debug button) and
  GeometryPreviewView.cpp (Geometry Diagnostics checkbox tooltip) with tr()
- Remove UTF-8 BOM from 27 inspector view .cpp files introduced by editor
- Run clang-format on all modified C++ files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add Translation_ts.IddCoverageForAllFields GTest that loops over every
IddObject in the OpenStudio IDD (via IddFactory) and verifies each field
name has a corresponding source entry in the IDD translation context of
OpenStudioApp_es.ts.

When the SDK adds new IDD objects/fields and the .ts file is not updated,
the test fails with a list of missing field names. The fix is to run
add_idd_skeleton.py then translate_skeleton.py to restore coverage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extend IddCoverageAllLanguages (renamed from IddCoverageForAllFields) to
iterate every OpenStudioApp_*.ts file in the translations directory rather
than only Spanish. For each language file the test independently extracts
the IDD context source strings and reports any field names missing from
that specific file, so drift after an SDK update is caught per-language.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds translation_check.yml workflow that runs on every PR and push to
master/develop. After running lupdate6 with -locations none:

- git diff detects if any .ts file changed — meaning strings were added
  to or removed from the C++ source without the translation files being
  updated.
- ci/check_translations.py classifies the diff: new type="unfinished"
  stubs (new tr() calls needing translation) vs type="obsolete" entries
  (tr() calls removed from source). Reports actionable fix instructions
  for each case and exits 1 so CI fails.

If the diff is empty, all .ts files are in sync and CI passes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…680)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…th tr()

- OSGridController: use tr() directly (class has Q_OBJECT, context matches)
- VariablesTabView: remove translate lambda, use QCoreApplication::translate
  with a named ctx string to avoid redefining tr in free function scope

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Explicit include required; cannot rely on transitive pulls from other Qt
headers on all build configurations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Not part of the project source; was accidentally committed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bring in tr() coverage for dialogs added since the last PR #873 update:
- Apply Measure Now, OSDialog buttons, Measure select prompt
- Online BCL / Find Measures, Find Components category tree (tid_api.xml)
- Component panel section headers and metadata row labels
- Sync Measures dialog, BCL taxonomy categories
- Change Default Libraries dialog
- Preferences > Change External Tools dialog
- Refrigeration, VRF, and other grid-view drop zone strings
- Measures sidebar labels, Python CLI tooltip
- Additional grid views across Facility, Spaces, Thermal Zones tabs

All 19 language .ts files updated; 0 unfinished entries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The 'Units Conversion' Yes/No dialog shown by DView when opening an
Energy+ SQL file is untranslatable via Qt's .ts system (external binary).

Add tr() wrappers for both strings and translate into all 18 supported
languages. The OpenStudio dialog and --ip/--si CLI forwarding are
commented out pending an updated DView build (Ski90Moo/wex
feat/ip-units-cli-flag); DView's own English prompt remains active
in the meantime.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Documents the mandatory pipeline for adding/updating translations,
including the fix_and_unvanish.py step that must follow every lupdate
run. Also covers common mistakes (lambda wrapping, currentText() with
model setters, unescaped ampersands).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
In Qt 6 the QMenuBar inherits the parent QMainWindow dark background
(#2C3233) instead of using the native platform style. Add explicit
QMenuBar rules alongside the existing MainWindow stylesheet so the
menu bar stays white with black text regardless of locale or restart.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@macumber macumber force-pushed the ski90moo-develop branch from 81c1241 to dbd5fd5 Compare May 31, 2026 17:45
@Ski90Moo
Copy link
Copy Markdown

Ski90Moo commented Jun 1, 2026

Fixed the Clang Format failure — switched to clang-format 18.1.3 (matching CI) and applied formatting to the 5 PR-touched files. Pushed in 0585d1f.

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