Complete language support to all GUI tabs#874
Open
macumber wants to merge 5 commits into
Open
Conversation
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>
There was a problem hiding this comment.
Pull request overview
This PR expands Qt translation support across the OpenStudio Application UI, covering additional tabs, inspector panels, grid headers, geometry web views, and translation validation tests.
Changes:
- Wraps many user-facing GUI strings with
tr()/QCoreApplication::translate(). - Adds translated display handling for output variables, IDD fields, taxonomy categories, and geometry HTML content.
- Adds translation regression tests to the OpenStudioApp test target.
Reviewed changes
Copilot reviewed 98 out of 100 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/shared_gui_components/WorkflowView.cpp | Localizes measure drop-zone text. |
| src/shared_gui_components/WorkflowController.cpp | Localizes workflow section names. |
| src/shared_gui_components/OSGridController.cpp | Localizes grid labels and buttons. |
| src/shared_gui_components/LocalLibraryView.cpp | Localizes local library buttons/tooltips. |
| src/shared_gui_components/LocalLibraryController.cpp | Translates taxonomy category labels. |
| src/openstudio_lib/VariablesTabView.cpp | Localizes output variables UI and frequency values. |
| src/openstudio_lib/ThermalZonesTabView.cpp | Localizes tab title. |
| src/openstudio_lib/ThermalZonesGridView.cpp | Localizes thermal zone grid labels. |
| src/openstudio_lib/SpaceTypesTabView.cpp | Localizes tab title. |
| src/openstudio_lib/SpaceTypesGridView.cpp | Localizes space type grid/filter labels. |
| src/openstudio_lib/SpacesTabController.cpp | Localizes spaces subtabs. |
| src/openstudio_lib/SpacesSubtabGridView.cpp | Localizes spaces filters. |
| src/openstudio_lib/Spaces*GridView.cpp | Localizes spaces grid headers/drop zones. |
| src/openstudio_lib/Facility* | Localizes facility tab, subtabs, and grids. |
| src/openstudio_lib/Constructions* | Localizes construction tabs/views/inspectors. |
| src/openstudio_lib/MaterialsView.cpp | Localizes material type list labels. |
| src/openstudio_lib/Material*InspectorView.cpp | Localizes material inspector labels. |
| src/openstudio_lib/WindowMaterial*InspectorView.cpp | Localizes window material inspector labels. |
| src/openstudio_lib/LoadsView.cpp | Localizes load type list labels. |
| src/openstudio_lib/*EquipmentInspectorView.cpp | Localizes load/equipment inspector labels. |
| src/openstudio_lib/PeopleInspectorView.cpp | Localizes people definition labels. |
| src/openstudio_lib/Schedules* | Localizes schedules tab, dialogs, and inspector labels. |
| src/openstudio_lib/ScheduleDayView.hpp/cpp | Adds translation support for graphics items and schedule UI. |
| src/openstudio_lib/HVACSystems* | Localizes HVAC tab, controls, and selectors. |
| src/openstudio_lib/LoopLibraryDialog.cpp | Localizes HVAC system library dialog. |
| src/openstudio_lib/GridItem.cpp | Localizes HVAC graphics text. |
| src/openstudio_lib/ServiceWaterGridItems.cpp | Localizes service water graphics text. |
| src/openstudio_lib/VRFGraphicsItems.cpp | Localizes VRF graphics drop zones. |
| src/openstudio_lib/RefrigerationGraphicsItems.cpp | Localizes refrigeration drop zone text. |
| src/openstudio_lib/Geometry* | Localizes geometry tab controls and injects locale into web views. |
| src/openstudio_lib/library/geometry_editor_start.html | Adds Spanish HTML translations for geometry help text. |
| src/openstudio_lib/RunTabView.cpp | Localizes run simulation controls/status text. |
| src/openstudio_lib/ResultsTabView.cpp | Localizes results UI and errors. |
| src/openstudio_lib/ResultsTabController.cpp | Localizes results tab title. |
| src/openstudio_lib/ScriptsTabView.cpp | Localizes measures tab controls. |
| src/openstudio_lib/OSDropZone.hpp/cpp | Localizes default drop-zone text. |
| src/openstudio_lib/OSItemSelectorButtons.cpp | Localizes item selector tooltips. |
| src/openstudio_lib/OSDocument.cpp | Localizes main vertical tab labels. |
| src/model_editor/InspectorGadget.cpp | Adds translated/bilingual IDD field display names. |
| src/openstudio_app/test/Translation_GTest.cpp | Adds translation source/runtime tests. |
| src/openstudio_app/CMakeLists.txt | Adds translation tests to app test sources. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "TaxonomyCategories", | ||
| }; | ||
|
|
||
| QSet<QString> foundContexts; |
Comment on lines
+92
to
+97
| populateFrequencyComboBox(m_combobox); | ||
| if (m_variable) { | ||
| // m_combobox->bind(*m_variable, "reportingFrequency"); | ||
| m_combobox->bind<std::string>( | ||
| *m_variable, static_cast<std::string (*)(const std::string&)>(&openstudio::toString), | ||
| std::bind(&model::OutputVariable::reportingFrequencyValues), std::bind(&model::OutputVariable::reportingFrequency, m_variable.get_ptr()), | ||
| std::bind(&model::OutputVariable::setReportingFrequency, m_variable.get_ptr(), std::placeholders::_1), | ||
| boost::optional<NoFailAction>(std::bind(&model::OutputVariable::resetReportingFrequency, m_variable.get_ptr())), | ||
| boost::optional<BasicQuery>(std::bind(&model::OutputVariable::isReportingFrequencyDefaulted, m_variable.get_ptr()))); | ||
| const int idx = m_combobox->findData(QString::fromStdString(m_variable->reportingFrequency())); | ||
| if (idx >= 0) { | ||
| m_combobox->setCurrentIndex(idx); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Duplicates #873 from @Ski90Moo on internal branch for CI