Complete language support to all GUI tabs#873
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
This is awesome @Ski90Moo! I will check this out! |
|
Thank you @macumber. It is rough, but a good start. I would like your feedback on the html issue. |
There was a problem hiding this comment.
Pull request overview
This PR expands internationalization across the OpenStudio Application UI by wrapping user-facing strings with Qt translation APIs and adding a significantly more complete Spanish translation as a proof of concept (Issue #680). It also introduces tests to validate the .ts file structure/content and (optionally) runtime .qm translation loading.
Changes:
- Wrapped many GUI string literals in
tr()/QCoreApplication::translate()across tabs, inspectors, and grid views. - Added bilingual display formatting for SDK-driven names (eg. Output Variables, IDD fields) to show
Translated (English)when non-English. - Added a new translation-focused GTest suite and wired it into the app test target.
Reviewed changes
Copilot reviewed 98 out of 100 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/shared_gui_components/WorkflowView.cpp | Translates “drop measure” placeholder text. |
| src/shared_gui_components/WorkflowController.cpp | Translates section headers for measure categories. |
| src/shared_gui_components/OSGridController.cpp | Translates “Custom” category label and apply-button text. |
| src/shared_gui_components/LocalLibraryView.cpp | Translates tooltips/button labels in the local library footer. |
| src/shared_gui_components/LocalLibraryController.cpp | Translates taxonomy category names at render time. |
| src/openstudio_lib/WindowMaterialSimpleGlazingSystemInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/WindowMaterialShadeInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/WindowMaterialScreenInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/WindowMaterialGlazingRefractionExtinctionMethodInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/WindowMaterialGlazingInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/WindowMaterialGasMixtureInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/WindowMaterialGasInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/WindowMaterialDaylightRedirectionDeviceInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/WindowMaterialBlindInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/WaterUseEquipmentInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/VRFGraphicsItems.cpp | Translates VRF drag/drop placeholder labels. |
| src/openstudio_lib/VariablesTabView.cpp | Adds translated+bilingual output variable display and localized frequency display with English data values. |
| src/openstudio_lib/ThermalZonesTabView.cpp | Translates main tab title. |
| src/openstudio_lib/ThermalZonesGridView.cpp | Translates grid headers/categories via QCoreApplication::translate. |
| src/openstudio_lib/SteamEquipmentInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/StandardsInformationMaterialWidget.cpp | Translates standards/measure-tags labels. |
| src/openstudio_lib/StandardsInformationConstructionWidget.cpp | Translates standards/measure-tags labels. |
| src/openstudio_lib/SpaceTypesTabView.cpp | Translates main tab title. |
| src/openstudio_lib/SpaceTypesGridView.cpp | Translates headers/categories/filter labels; some tooltips still hardcoded. |
| src/openstudio_lib/SpacesTabController.cpp | Translates spaces sub-tab titles. |
| src/openstudio_lib/SpacesSurfacesGridView.cpp | Translates grid headers/categories. |
| src/openstudio_lib/SpacesSubtabGridView.cpp | Translates filter labels; stores English keys in combo box data for SDK values. |
| src/openstudio_lib/SpacesSubsurfacesGridView.cpp | Translates grid headers/categories. |
| src/openstudio_lib/SpacesSpacesGridView.cpp | Translates grid headers/categories. |
| src/openstudio_lib/SpacesShadingGridView.cpp | Translates grid headers/categories. |
| src/openstudio_lib/SpacesLoadsGridView.cpp | Translates grid headers/categories. |
| src/openstudio_lib/SpacesInteriorPartitionsGridView.cpp | Translates grid headers/categories. |
| src/openstudio_lib/SimSettingsTabController.cpp | Translates “Simulation Settings” tab title. |
| src/openstudio_lib/ServiceWaterGridItems.cpp | Translates tooltips and drop-zone placeholder text. |
| src/openstudio_lib/ScriptsTabView.cpp | Translates “Measures” tab title and sync button strings. |
| src/openstudio_lib/SchedulesTabView.cpp | Translates schedules sub-tab title. |
| src/openstudio_lib/SchedulesTabController.cpp | Translates schedules sub-tab titles. |
| src/openstudio_lib/ScheduleSetInspectorView.cpp | Translates schedule set inspector section labels. |
| src/openstudio_lib/ScheduleOthersView.cpp | Translates “Schedule Others” type names returned to the list view. |
| src/openstudio_lib/ScheduleOthersController.cpp | Translates unsupported-action message text. |
| src/openstudio_lib/ScheduleFileInspectorView.cpp | Translates labels and attempts to translate separator choices (but bind() will overwrite). |
| src/openstudio_lib/ScheduleDialog.cpp | Translates dialog labels and “None/unitless” strings. |
| src/openstudio_lib/ScheduleDayView.hpp | Adds Q_DECLARE_TR_FUNCTIONS for QGraphicsItem subclasses to enable tr(). |
| src/openstudio_lib/ScheduleDayView.cpp | Translates schedule day UI strings/tooltips and keyboard prompt text. |
| src/openstudio_lib/ScheduleConstantInspectorView.cpp | Translates labels (one includes leading whitespace in the source string). |
| src/openstudio_lib/ScheduleCompactInspectorView.cpp | Translates labels. |
| src/openstudio_lib/RunTabView.cpp | Translates run tab title, button/checkbox labels, and status text. |
| src/openstudio_lib/ResultsTabView.cpp | Translates Results UI labels and some report names; “Custom Report N” uses concatenation. |
| src/openstudio_lib/ResultsTabController.cpp | Translates “Results Summary” tab title. |
| src/openstudio_lib/RefrigerationGraphicsItems.cpp | Translates refrigeration drop-zone placeholder text. |
| src/openstudio_lib/PeopleInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/OtherEquipmentInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/OSItemSelectorButtons.cpp | Translates toolbar button tooltips. |
| src/openstudio_lib/OSDropZone.hpp | Changes default text arg to empty so ctor can apply translated default. |
| src/openstudio_lib/OSDropZone.cpp | Applies translated default “Drag From Library” when text is empty. |
| src/openstudio_lib/OSDocument.cpp | Translates left-side main tab button labels. |
| src/openstudio_lib/MaterialsView.cpp | Translates materials category names returned to list view. |
| src/openstudio_lib/MaterialRoofVegetationInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/MaterialNoMassInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/MaterialInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/MaterialAirGapInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/LuminaireInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/LoopLibraryDialog.cpp | Translates HVAC library dialog titles/buttons/system names. |
| src/openstudio_lib/LoadsView.cpp | Translates loads category names returned to list view. |
| src/openstudio_lib/LightsInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/library/geometry_editor_start.html | Adds an in-HTML Spanish translation dictionary + DOM rewrite for headings/paragraphs. |
| src/openstudio_lib/InternalMassInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/HVACSystemsTabView.cpp | Translates main tab title. |
| src/openstudio_lib/HVACSystemsController.cpp | Translates system selector entries and HVAC type labels; translates some drop-zone text. |
| src/openstudio_lib/HotWaterEquipmentInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/GridItem.cpp | Translates drop-zone placeholder and “Supply/Demand Equipment” labels. |
| src/openstudio_lib/GeometryTabController.cpp | Translates geometry tab title and sub-tab titles. |
| src/openstudio_lib/GeometryPreviewView.cpp | Injects locale into embedded web content; translates some UI strings. |
| src/openstudio_lib/GeometryEditorView.cpp | Injects locale into embedded editor; translates most UI strings and some dialogs. |
| src/openstudio_lib/GasEquipmentInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/FacilityTabView.cpp | Translates facility tab title. |
| src/openstudio_lib/FacilityTabController.cpp | Translates facility sub-tab titles. |
| src/openstudio_lib/FacilityStoriesGridView.cpp | Translates grid headers/categories and filter label. |
| src/openstudio_lib/FacilityShadingGridView.cpp | Translates grid headers/categories and uses English keys in filter combo data. |
| src/openstudio_lib/FacilityExteriorEquipmentGridView.cpp | Translates grid headers/categories and view titles. |
| src/openstudio_lib/ElectricEquipmentInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/ConstructionsView.cpp | Translates constructions category names returned to list view. |
| src/openstudio_lib/ConstructionsTabController.cpp | Translates constructions sub-tab titles and main tab title. |
| src/openstudio_lib/ConstructionInternalSourceInspectorView.cpp | Translates inspector labels and drop-zone text (and file gained a BOM). |
| src/openstudio_lib/ConstructionInspectorView.cpp | Translates inspector labels and drop-zone text. |
| src/openstudio_lib/ConstructionFfactorGroundFloorInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/ConstructionCfactorUndergroundWallInspectorView.cpp | Translates inspector labels (and file gained a BOM). |
| src/openstudio_lib/ConstructionAirBoundaryInspectorView.cpp | Translates inspector labels and comments (and file gained a BOM). |
| src/openstudio_lib/BuildingInspectorView.cpp | Translates building inspector labels. |
| src/openstudio_app/test/Translation_GTest.cpp | Adds tests to validate .ts content and optionally .qm runtime translation. |
| src/openstudio_app/CMakeLists.txt | Adds Translation_GTest.cpp to the test sources. |
| src/model_editor/InspectorGadget.cpp | Adds bilingual IDD field display names with runtime translation lookup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 openstudiocoalition#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>
…penstudiocoalition#680) 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 openstudiocoalition#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>
…#680) 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>
…penstudiocoalition#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 á) 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>
…oalition#680) - 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>
…diocoalition#680) 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>
…tion#680) 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>
…penstudiocoalition#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 openstudiocoalition#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>
…nstudiocoalition#680) 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>
|
Thanks for flagging this @jmarrec — that's exactly the kind of subtle breakage that's hard to catch in review. I did an exhaustive audit of every
Zero instances of a translated string reaching an SDK model setter. The |
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>
|
|
||
| ``` | ||
| cmake --build . --target OpenStudioApplication_lupdate | ||
| python fix_and_unvanish.py |
There was a problem hiding this comment.
I don't see translate_all_languages.py or fix_and_unvanish.py
| | `retranslate_stubborn.py` | Re-translate any entries that came back empty from the batch run | | ||
| | `recover_batches.py` | Re-poll known batch IDs after a network failure | |
There was a problem hiding this comment.
These two are also missing?
| *.sublime-workspace | ||
|
|
||
| # Qt-generated files | ||
| src/openstudio_lib/moc_*.cpp |
There was a problem hiding this comment.
This should not be necessary, all generated files should be in the build directory.
| # OpenStudio Application — Translation Workflow | ||
|
|
||
| This document describes the full pipeline for adding or updating translations in | ||
| `OpenStudioApp_<lang>.ts` files. |
There was a problem hiding this comment.
Is translate_new_languages.py missing?
There was a problem hiding this comment.
Do you need to add these new translations to the list translations/CMakeLists.txt?
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:
translations/OpenStudioApp_es.ts grows from ~200 to 3017 entries.
New languages only require a new .ts file with no further C++ changes.
The exception is the Geometry tab HTML files (geometry_editor_start.html and geometry_preview.html) each contain a hardcoded JavaScript dictionary keyed by locale code. We could:
Option A — Keep the Geometry tab HTML as an exception requiring separate edits.
Option B — Improve the architecture (better): Have the C++ side inject the locale into the HTML page at load time via QWebEnginePage::runJavaScript(), and move the translations out of the HTML into the .ts file.
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
DView Units Conversion dialog
The "Would you like to display your Energy+ data in IP units?" dialog shown when opening DView for detailed reports is rendered by the
dviewx64.exebinary (wxWidgets) and cannot be translated through Qt's.tssystem.A companion PR has been opened against the upstream wex library to add
--ip/--siCLI flags to DView: NatLabRockies/wex#197Once that PR merges and a new DView binary is deployed, the OpenStudio side will show its own translated Qt dialog and forward the user's answer to DView via CLI flag, bypassing DView's English-only prompt. The relevant code is already in place in
ResultsTabView.cppand commented out pending the new binary.Extra testing required