Complete language support to all GUI tabs#874
Open
macumber wants to merge 17 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); | ||
| } |
…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>
- 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>
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