Skip to content

Complete language support to all GUI tabs#873

Open
Ski90Moo wants to merge 31 commits into
openstudiocoalition:developfrom
Ski90Moo:develop
Open

Complete language support to all GUI tabs#873
Ski90Moo wants to merge 31 commits into
openstudiocoalition:developfrom
Ski90Moo:develop

Conversation

@Ski90Moo
Copy link
Copy Markdown

@Ski90Moo Ski90Moo commented May 10, 2026

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.

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.exe binary (wxWidgets) and cannot be translated through Qt's .ts system.

A companion PR has been opened against the upstream wex library to add --ip/--si CLI flags to DView: NatLabRockies/wex#197

Once 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.cpp and commented out pending the new binary.

Extra testing required

  • ScheduleFileInspector - especially the separator
  • VariablesTab

Ski90Moo and others added 4 commits May 4, 2026 15:21
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>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 10, 2026

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@Ski90Moo
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request May 10, 2026
@macumber
Copy link
Copy Markdown
Collaborator

This is awesome @Ski90Moo! I will check this out!

@Ski90Moo
Copy link
Copy Markdown
Author

Thank you @macumber. It is rough, but a good start. I would like your feedback on the html issue.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/openstudio_lib/VariablesTabView.cpp
Comment thread src/openstudio_lib/ScheduleFileInspectorView.cpp
Comment thread src/openstudio_lib/SpaceTypesGridView.cpp Outdated
Comment thread src/openstudio_lib/GeometryPreviewView.cpp Outdated
Comment thread src/openstudio_lib/GeometryEditorView.cpp Outdated
Comment thread src/openstudio_lib/ResultsTabView.cpp
Comment thread src/openstudio_lib/WindowMaterialSimpleGlazingSystemInspectorView.cpp Outdated
Comment thread src/openstudio_lib/ScheduleConstantInspectorView.cpp
Comment thread src/openstudio_lib/GeometryEditorView.cpp Outdated
Comment thread src/model_editor/InspectorGadget.cpp
Comment thread src/openstudio_lib/library/geometry_editor_start.html Outdated
Comment thread translations/OpenStudioApp_es.ts Outdated
Comment thread src/openstudio_lib/MaterialsView.cpp Outdated
Comment thread src/openstudio_lib/ScheduleOthersView.cpp Outdated
Comment thread src/openstudio_lib/SchedulesView.cpp Outdated
Comment thread src/openstudio_lib/SpacesInteriorPartitionsGridView.cpp Outdated
Comment thread src/openstudio_lib/SpacesLoadsGridView.cpp Outdated
Comment thread src/openstudio_lib/SpacesShadingGridView.cpp Outdated
Comment thread src/openstudio_lib/SpacesSpacesGridView.cpp Outdated
Comment thread src/openstudio_lib/SpacesSubsurfacesGridView.cpp Outdated
Comment thread src/openstudio_lib/SpacesSubtabGridView.cpp Outdated
Comment thread src/openstudio_lib/SpacesSurfacesGridView.cpp Outdated
Comment thread src/openstudio_lib/SpaceTypesGridView.cpp Outdated
Comment thread src/openstudio_lib/ThermalZonesGridView.cpp Outdated
Comment thread src/openstudio_lib/library/geometry_preview.html Outdated
Comment thread src/openstudio_lib/ConstructionsView.cpp Outdated
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>
@jmarrec
Copy link
Copy Markdown
Collaborator

jmarrec commented May 29, 2026

I need to review this in more details but thanks a lot @Ski90Moo

FWIW, there are a couple of issued that might arise (and that AI wouldn't catch):

Once you translate a string, you can no longer call something like:

QString qs = tr("SomeEnglishValue");
modelObject.setXXXX(qs.toStdString()).

One example: be96ac1

@Ski90Moo
Copy link
Copy Markdown
Author

I need to review this in more details but thanks a lot @Ski90Moo

FWIW, there are a couple of issued that might arise (and that AI wouldn't catch):

Once you translate a string, you can no longer call something like:

QString qs = tr("SomeEnglishValue");
modelObject.setXXXX(qs.toStdString()).

One example: be96ac1

Thank you for the feedback @jmarrec. Let me look into this.

Ski90Moo and others added 2 commits May 30, 2026 21:24
…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>
Ski90Moo added a commit to Ski90Moo/OpenStudioApplication that referenced this pull request May 30, 2026
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>
@Ski90Moo
Copy link
Copy Markdown
Author

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 toStdString() and currentText() call added by this PR. Here's what I found:

tr().toStdString() calls (21 occurrences) — all are the second argument to addCheckBoxColumn / addSelectColumn, which is const std::string& tooltip. These feed the column header tooltip in the Qt grid widget, never the model SDK.

currentData().toString().toStdString() → model setter (3 occurrences):

  • ScheduleFileInspectorView: m_sch->setColumnSeparator(m_columnSeparator->currentData().toString().toStdString()) — uses currentData()
  • VariablesTabView: m_variable->setReportingFrequency(m_combobox->currentData().toString().toStdString()) — uses currentData()
  • SpacesSubtabGridView filter comparisons: data = currentData().toString() then data.toStdString() used as a filter predicate against model getter values — not a setter ✓

UtilityBillsView translated fuel names (12 occurrences): std::pair<FuelType, std::string> where the translated string goes only to OSCollapsibleItemHeader (display label). The FuelType enum key is what reaches the model. ✓

currentText() == tr(...) comparisons (5 occurrences in GeometryEditorView and SpacesSubtabGridView): Used for UI branching (which editor class to show, whether to apply a filter). No model setter in the branch bodies. ✓

field == tr(...) column-type switch in FacilityExteriorEquipmentGridView (~30 occurrences): The translated string discriminates which addNameLineEditColumn / addParentNameLineEditColumn call to make. Model access goes through function pointers (&model::ModelObject::setName), never through the translated string itself. ✓

Zero instances of a translated string reaching an SDK model setter. The addItem(tr(display), QStringLiteral("EnglishData")) + currentData() pattern is used consistently wherever a combo drives a model write — this is also documented in translations/TRANSLATION_WORKFLOW.md as a required pattern.

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>
Comment thread translations/TRANSLATION_WORKFLOW.md
Comment thread translations/TRANSLATION_WORKFLOW.md
Comment thread .gitignore Outdated
# OpenStudio Application — Translation Workflow

This document describes the full pipeline for adding or updating translations in
`OpenStudioApp_<lang>.ts` files.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is translate_new_languages.py missing?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

translate_new_languages.py was a one-off bootstrap script for the 4 new languages; those are now fully covered by translate_all_languages.py which handles all 18. Left it out as redundant.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about if we want to add a new language?

Copy link
Copy Markdown
Author

@Ski90Moo Ski90Moo Jun 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an Adding a new language section to TRANSLATION_WORKFLOW.md covering the five steps: add the .ts entry and post-build copy commands to translations/CMakeLists.txt, add the locale to the LANGUAGES dict in translate_all_languages.py, then run the standard lupdate → fix_and_unvanish → translate_all_languages → fix_and_unvanish → lrelease pipeline. lupdate creates the .ts file automatically on the first run.

Commits: f6642ba (TRANSLATION_WORKFLOW.md "Adding a new language" section), 3bce8c5 (translation helper scripts), d3b7090 (adds add_language_to_menu.py to automate the five C++ touch points when wiring a new language into the menu).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to add these new translations to the list translations/CMakeLists.txt?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes — added id, ko, pt, and tr to TS_FILES and added post-build copy commands in 4c22eb1. Indonesian follows the same commented-out pattern as Hindi/Vietnamese/Greek since Qt does not ship qt_id/qtbase_id. Portuguese uses the pt_BR variants (qt_pt_BR.qm, qtbase_pt_BR.qm, pt-BR.pak) as Qt does not ship a plain pt variant.

Copy link
Copy Markdown
Collaborator

@macumber macumber Jun 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at 4c22eb1 but it doesn't show up on this PR's changed files?

I think there is a typo in the existing translations/CMakeLists.txt ${WEBENGINE_PAK_FOLDER}/vi.pak is listed for German.

Copy link
Copy Markdown
Author

@Ski90Moo Ski90Moo Jun 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — line 151 was copying vi.pak (Vietnamese) instead of de.pak for the German WebEngine locales block. That was a copy-paste error from the Vietnamese section directly above it. Audited all 18 language blocks; it was the only mismatch.

Re the commit not appearing in "Files changed": the "does not belong to any branch on this repository" message is normal for cross-fork PRs — the commit is on Ski90Moo/OpenStudioApplication (the fork), not on the openstudiocoalition repo directly. GitHub knows about it because the PR is open, but it lives on the fork side. The reason it may not be visible in the "Files changed" tab is that this PR is very large (18 .ts files each several thousand lines, plus dozens of .cpp files), and GitHub stops rendering the diff after hitting its size limit. The changes are in the cumulative diff — please search for translations/CMakeLists.txt in the "Files changed" search box to jump directly to it.

Commits: 4c22eb1 (register 4 new languages in CMakeLists.txt with .ts entries and post-build copy commands), 3e1c01c (fix de.pak copy-paste typo).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@jmarrec jmarrec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to take a careful decision on whether we think OutputVariables should be translated at all: poor translations, and too many of them (1432) to burden a human with.

The IDD bit might fall into the same bucket: it has even more entries: 3842, though a spot check didn't concern me as much in terms of translation

One thing to consider is that, while I didn't do timings, I'm pretty sure the build got a lot lengthier.

Comment on lines +1 to +4
# OpenStudio Application — Translation Workflow

This document describes the full pipeline for adding or updating translations in
`OpenStudioApp_<lang>.ts` files.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# OpenStudio Application — Translation Workflow
This document describes the full pipeline for adding or updating translations in
`OpenStudioApp_<lang>.ts` files.
# OpenStudio Application — Translation Workflow
This document describes the full pipeline for adding or updating translations in
`OpenStudioApp_<lang>.ts` files via AI.
**NOTE:** The preferred way is still to use a bilingual user do the translations themselves using Qt Linguist. Please refer to the Wiki [Internationalization: Translating the OpenStudioApplication to another target language](https://github.com/openstudiocoalition/OpenStudioApplication/wiki/Internationalization:-Translating-the-OpenStudioApplication-to-another-target-language)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in b70dc87 — added a callout block at the top of the doc noting this covers the AI-assisted pipeline and linking to the wiki for the preferred human-translation (Qt Linguist) workflow.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff is too large for github to comment directly here.

All translation files, including this one, have this block in there:

    <message>
        <location filename="../src/model_editor/InspectorDialog.cpp" line="585"/>
        <source>Purge unused objects</source>
        <translatorcomment>La palabra purgar no tiene el mismo contexto en Español.</translatorcomment>
        <translation>Borrar todos los objetos sin usar</translation>
    </message>

I have spot checked only a few locations so far and I'm finding that it is what I expected:

  • For regular english (eg: "Add an object") the translation is good enough
  • For domain-specific wording, it's really less than ideal
    • "Dry bulb temperature" shouldn't be "Température de Bulbe humide" (literal translation), but "Température Humide"
    • Glass Doors are translated as "Portes en Verre" instead of the more apt "Portes vitrées" (that would be ok)
    • Most of the HVAC specific stuff is just bogus
    • etc

I'm noticing that the OutputVariables have been translated. I don't think I ever expected to do that:

  1. I find it confusing because you'd typically have to read the E+ I/O reference guide to understand what a variable represents.
    a. Edit: Ok I see you at least kept the English name of the variable too in parentheses, smart choice (se picture below)
  2. I don't think the variables shouldn't even be proposed for translation since the tab is populated by a call to static std::vector<std::string>& ModelObject::outputVariables() const. That also explains why the snippets don't have any <location> tag
    a. @Ski90Moo did you "trick" Claude into adding these translations?
  3. The french translation appears horrendous for these, and given it's 1400 entries, I'm not particularly inclined to manually translate them. Perhaps it's a bad idea.
Image

Qt Linguist also correctly flags a lot of the translations do "not have the same leading and trailing whitespace as the source text".

Image

Eg Name: becomes Nom : when it should be Nom :

Some things have a a built line break, that isn't respected and it shows weirdly in the UI (and I'm not talking about how absolutely ridiculous the translation sounds in French lol)

    <message>
        <location filename="../src/openstudio_lib/LoopLibraryDialog.cpp" line="74"/>
        <source>Packaged DX Rooftop VAV 
with Reheat</source>
        <translation>Unité de Toit Toute Faite DX VAV avec Réchauffage</translation>
    </message>

As a result it's cut-off here:

Image

(the next translation is a gem 😆 "Packaged Rooftop VAV with Parallel Fan Power Boxes and reheat" is translated to "Toit-Terrasse Emballé VAV avec Boîtes de Puissance à Ventilateur Parallèle et Réchauffage" suggesting that there is a flat roof that is wrapped (for shipping perhaps?) and it has )

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed review. Addressing each point in 31f9508:

Whitespace (Name: etc.): Fixed — added a step to fix_and_unvanish.py that restores leading/trailing spaces in translations to match the source string. Resolved ~6900 Qt Linguist warnings across all 18 languages.

Embedded newlines: Fixed — for LoopLibraryDialog HVAC system names, removed the hard \n from C++ source strings and made the dialog resizable (setMinimumSize + setSizeGripEnabled + setWordWrap). For all other strings (grid column headers, drop zones, etc.) the \n is a genuine layout constraint; applied proportional-position insertion to restore missing newlines in translations.

Domain-specific quality: Agreed the machine translations are imperfect — particularly HVAC terminology. That is the nature of the AI-assisted bootstrap; the intent is for bilingual contributors to refine via Qt Linguist. The note added to TRANSLATION_WORKFLOW.md (b70dc87) now makes this explicit.

OutputVariables: Will address separately — see the open question about whether these 1400 entries should be translated at all.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thought was that we would send a link to an RC to everyone who has expressed interest in translations and ask then to review their native languages and contribute changes in translations back.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, agreed. I would first like to fine tune the machine translation to help take the load off of the contributors. I have some ideas for using a prompt with context, from Big Ladder, for the Output Variables, and possibly the Idd object fields, that might help clear up some of the poor machine translations. I am also reconsidering the Tooltip idea. If the user could hover and left or right-click to copy the English text, that would help them quickly find what they need in the EnergyPlus documentation pdfs. In this case maybe we wouldn't need to display the English in Italics? If it is a hurry, I can remove the Output Variables and/or Idd translations from the .ts files for now and we can address them in a future PR?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thought was that we would send a link to an RC to everyone who has expressed interest in translations and ask then to review their native languages and contribute changes in translations back.

I did the french translation, and I'm not particularly inclined to open Qt Linguist and review the 1400 output variables and 3842 IDD ones, as It would take a huge (and painful) chunk of time, hence why I said we need to decide carefully.

Comment on lines +74 to +80
const QString qname = QString::fromStdString(englishName);
if (QLocale().language() != QLocale::English) {
const QString translated = QCoreApplication::translate("IDD", englishName.c_str());
if (translated != qname)
return translated + " (" + qname + ")";
}
return qname;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice concept.

If we go this route, we should tweak the display though, it's cluttered

Image

The english original field name should be on its own line in italic, or perhaps a it should be a QTooltip.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point — went with HTML formatting instead: the translated name on the first line, English original in small gray italics on the second line (31f9508). Tooltip was considered but rejected: a non-English speaker cross-referencing EnergyPlus documentation while looking at the inspector would find it frustrating to have the English name appear and vanish with cursor movement. The persistent second line keeps both names visible at all times.

Ski90Moo and others added 5 commits June 1, 2026 17:55
Add the six Python scripts referenced in TRANSLATION_WORKFLOW.md and the
IddCoverageAllLanguages test but absent from the PR:

- fix_and_unvanish.py        — un-vanish translated entries; promote unfinished
- translate_all_languages.py — batch-translate new strings into all 18 languages
- retranslate_stubborn.py    — re-translate remaining empty entries
- recover_batches.py         — re-poll batch IDs after network failure
- add_idd_skeleton.py        — add missing IDD field names as unfinished stubs
- translate_skeleton.py      — translate IDD context stubs via Claude batch API

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add OpenStudioApp_{id,ko,pt,tr}.ts to qt6_add_translations TS_FILES so
  the .qm files are compiled and deployed on all platforms, not just when
  pre-built .qm files happen to be present in the source tree.
- Add post-build copy commands for Qt system translations (qt_ko, qt_tr,
  qt_pt_BR, qtbase_*) and WebEngine pak files for the four new languages.
  Indonesian follows the same commented-out pattern as Hindi/Vietnamese/Greek
  since Qt does not ship qt_id / qtbase_id translations.
- Remove stale moc_*.cpp entry from .gitignore; Qt 6 + CMake always
  generates moc files in the build directory, never in the source tree.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
IDD field display (InspectorGadget.cpp):
- Replace 'Translation (English)' inline format with HTML: translated name
  on first line, English original in small gray italics on second line.
  Non-English speakers can cross-reference EnergyPlus docs without switching
  languages; tooltip approach was rejected as cursor-precision-dependent.

Whitespace restoration (fix_and_unvanish.py + all .ts files):
- Add Step 4 to fix_and_unvanish.py: restore leading/trailing spaces in
  translations to match source strings (stripped by .strip() in translation
  scripts). Fixes ~6900 Qt Linguist whitespace-mismatch warnings.

Newline fixes (all .ts files):
- For LoopLibraryDialog strings: remove hard \n breaks from both C++ source
  and all translations now that the dialog is resizable.
- For all other \n-containing strings (grid headers, drop zones, etc.):
  apply proportional-position insertion to restore missing \n in translations.

LoopLibraryDialog resize (LoopLibraryDialog.cpp):
- Replace setFixedSize(280,584) with setMinimumSize(280,400) + setSizeGripEnabled.
- Add setWordWrap(true) and remove Qt::AlignLeft from addWidget so label
  stretches to full item width and reflows correctly on resize.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Per jmarrec review: add a callout at the top noting this doc covers the
AI-assisted bootstrap pipeline, and linking to the wiki for the preferred
human-translation workflow via Qt Linguist.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
translations/CMakeLists.txt line 151 was copying vi.pak (Vietnamese)
instead of de.pak. Copy-paste error from the Vietnamese section
directly above it. Audited all 18 language blocks — only mismatch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Ski90Moo
Copy link
Copy Markdown
Author

Ski90Moo commented Jun 2, 2026

We need to take a careful decision on whether we think OutputVariables should be translated at all: poor translations, and too many of them (1432) to burden a human with.

The IDD bit might fall into the same bucket: it has even more entries: 3842, though a spot check didn't concern me as much in terms of translation

One thing to consider is that, while I didn't do timings, I'm pretty sure the build got a lot lengthier.

Another thought I had: would it be possible to gather user provided feedback/translations on these? For example, the user could right or left click the translation, it would copy the specific English and target language strings and take them to a dialog online to submit an alternative translation? This would greatly accelerate the translation process (or complicate it 😅).

Ski90Moo and others added 3 commits June 2, 2026 20:55
- fix_and_unvanish.py: add Step 5 to escape bare XML chars (<, >, &) in
  finished translation text, preventing lrelease parse errors
- translate_all_languages.py: add --lang and --skip-contexts CLI args;
  extract_unfinished now marks skipped-context entries so IDs stay stable
- add_language_to_menu.py: new script that automates all 5 C++ touch
  points when wiring a new language into MainMenu.hpp/.cpp

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add a six-step "Adding a new language" section covering the C++ menu
wiring script, CMakeLists.txt entries, translate_all_languages.py update,
and the standard pipeline. Expand the helper scripts table with
add_language_to_menu.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Apply fix_and_unvanish.py Step 5 retroactively: escape bare > characters
as &gt; in finished translation text for consistency. Bare < characters
(the hard XML error) were not present in the existing 18 files, but > is
normalized here for correctness and to prevent future lrelease surprises.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

4 participants