From 8e8a3c7bdca0a9c9a8edf219df094744ebb4ff26 Mon Sep 17 00:00:00 2001 From: Gary Kim Date: Sat, 31 Dec 2022 18:39:04 -0500 Subject: [PATCH] Do not translate name in version info Leave the application name in version info untranslated when viewed, copied, or used in a bug report. Fixes https://gitlab.com/kicad/code/kicad/-/issues/13298 --- 3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp | 2 +- common/dialog_about/dialog_about.cpp | 5 +++-- common/dialog_about/dialog_about.h | 1 + common/tool/common_control.cpp | 2 +- eeschema/sch_edit_frame.cpp | 2 +- eeschema/symbol_editor/symbol_edit_frame.cpp | 2 +- eeschema/symbol_viewer_frame.cpp | 2 +- gerbview/gerbview_frame.cpp | 2 +- include/eda_base_frame.h | 4 +++- pagelayout_editor/pl_editor_frame.cpp | 2 +- pcbnew/footprint_edit_frame.cpp | 2 +- pcbnew/footprint_viewer_frame.cpp | 2 +- pcbnew/pcb_edit_frame.cpp | 2 +- 13 files changed, 17 insertions(+), 13 deletions(-) diff --git a/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp b/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp index 3a666e5ec0..6e4bd2a443 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp +++ b/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp @@ -98,7 +98,7 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME %s" ), aTitle ); m_disable_ray_tracing = false; - m_aboutTitle = _( "KiCad 3D Viewer" ); + m_aboutTitle = _HKI( "KiCad 3D Viewer" ); // Give it an icon wxIcon icon; diff --git a/common/dialog_about/dialog_about.cpp b/common/dialog_about/dialog_about.cpp index 49904049e1..acb0c47967 100644 --- a/common/dialog_about/dialog_about.cpp +++ b/common/dialog_about/dialog_about.cpp @@ -89,6 +89,7 @@ DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo ) } m_titleName = aParent->GetAboutTitle(); + m_untranslatedTitleName = aParent->GetUntranslatedAboutTitle(); m_staticTextAppTitle->SetLabel( m_titleName ); m_staticTextCopyright->SetLabel( m_info.GetCopyright() ); m_staticTextBuildVersion->SetLabel( "Version: " + m_info.GetBuildVersion() ); @@ -126,7 +127,7 @@ void DIALOG_ABOUT::createNotebooks() createNotebookHtmlPage( m_notebook, _( "About" ), IMAGES::INFORMATION, m_info.GetDescription() ); - wxString version = GetVersionInfoData( m_titleName, true ); + wxString version = GetVersionInfoData( m_untranslatedTitleName, true ); createNotebookHtmlPage( m_notebook, _( "Version" ), IMAGES::VERSION, version, true ); @@ -464,7 +465,7 @@ void DIALOG_ABOUT::onCopyVersionInfo( wxCommandEvent& event ) return; } - wxString msg_version = GetVersionInfoData( m_titleName ); + wxString msg_version = GetVersionInfoData( m_untranslatedTitleName ); wxTheClipboard->SetData( new wxTextDataObject( msg_version ) ); wxTheClipboard->Flush(); // Allow clipboard data to be available after KiCad closes diff --git a/common/dialog_about/dialog_about.h b/common/dialog_about/dialog_about.h index 6057c46b9f..87c289f452 100644 --- a/common/dialog_about/dialog_about.h +++ b/common/dialog_about/dialog_about.h @@ -55,6 +55,7 @@ class DIALOG_ABOUT : public DIALOG_ABOUT_BASE private: wxImageList* m_images; wxString m_titleName; + wxString m_untranslatedTitleName; ABOUT_APP_INFO& m_info; diff --git a/common/tool/common_control.cpp b/common/tool/common_control.cpp index 7506f8f280..dba251cd24 100644 --- a/common/tool/common_control.cpp +++ b/common/tool/common_control.cpp @@ -287,7 +287,7 @@ int COMMON_CONTROL::ReportBug( const TOOL_EVENT& aEvent ) if( WarnUserIfOperatingSystemUnsupported() ) return 0; - wxString version = GetVersionInfoData( m_frame->GetAboutTitle(), false, true ); + wxString version = GetVersionInfoData( m_frame->GetUntranslatedAboutTitle(), false, true ); wxString message; message.Printf( m_bugReportTemplate, version ); diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index b291293ce5..b4f8047f61 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -123,7 +123,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_showBorderAndTitleBlock = true; // true to show sheet references m_supportsAutoSave = true; m_syncingPcbToSchSelection = false; - m_aboutTitle = _( "KiCad Schematic Editor" ); + m_aboutTitle = _HKI( "KiCad Schematic Editor" ); m_findReplaceDialog = nullptr; diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index 4a44b8e7f1..79eca3f529 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -111,7 +111,7 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_libMgr = nullptr; m_unit = 1; m_convert = 1; - m_aboutTitle = _( "KiCad Symbol Editor" ); + m_aboutTitle = _HKI( "KiCad Symbol Editor" ); wxIcon icon; wxIconBundle icon_bundle; diff --git a/eeschema/symbol_viewer_frame.cpp b/eeschema/symbol_viewer_frame.cpp index 32584cb9de..c428fa5b88 100644 --- a/eeschema/symbol_viewer_frame.cpp +++ b/eeschema/symbol_viewer_frame.cpp @@ -117,7 +117,7 @@ SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAM if( aFrameType == FRAME_SCH_VIEWER_MODAL ) SetModal( true ); - m_aboutTitle = _( "KiCad Symbol Library Viewer" ); + m_aboutTitle = _HKI( "KiCad Symbol Library Viewer" ); // Force the frame name used in config. the lib viewer frame has a name // depending on aFrameType (needed to identify the frame by wxWidgets), diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 6d2b093f79..6952439db5 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -83,7 +83,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ) m_apertText = nullptr; m_dcodeText = nullptr; m_displayMode = 0; - m_aboutTitle = _( "KiCad Gerber Viewer" ); + m_aboutTitle = _HKI( "KiCad Gerber Viewer" ); SHAPE_POLY_SET dummy; // A ugly trick to force the linker to include // some methods in code and avoid link errors diff --git a/include/eda_base_frame.h b/include/eda_base_frame.h index 701ac90203..c6a1ed86cc 100644 --- a/include/eda_base_frame.h +++ b/include/eda_base_frame.h @@ -503,7 +503,9 @@ public: */ virtual void ProjectChanged() {} - const wxString& GetAboutTitle() const { return m_aboutTitle; } + const wxString& GetAboutTitle() const { return wxGetTranslation( m_aboutTitle ); } + + const wxString& GetUntranslatedAboutTitle() const { return m_aboutTitle; } /** * Get if the contents of the frame have been modified since the last save. diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index ac7be7809d..e816c3e3d5 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -95,7 +95,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_showBorderAndTitleBlock = true; // true for reference drawings. DS_DATA_MODEL::GetTheInstance().m_EditMode = true; - m_aboutTitle = _( "KiCad Drawing Sheet Editor" ); + m_aboutTitle = _HKI( "KiCad Drawing Sheet Editor" ); // Give an icon wxIcon icon; diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 9037c5c74c..b77b080639 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -111,7 +111,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_show_layer_manager_tools( true ) { m_showBorderAndTitleBlock = false; // true to show the frame references - m_aboutTitle = _( "KiCad Footprint Editor" ); + m_aboutTitle = _HKI( "KiCad Footprint Editor" ); m_selLayerBox = nullptr; m_editorSettings = nullptr; diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index 1e460043c4..be66cc95cb 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -124,7 +124,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent if( aFrameType == FRAME_FOOTPRINT_VIEWER_MODAL ) SetModal( true ); - m_aboutTitle = _( "KiCad Footprint Library Viewer" ); + m_aboutTitle = _HKI( "KiCad Footprint Library Viewer" ); // Force the items to always snap m_magneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_ALWAYS; diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index fb8cb63b04..7e3b451605 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -199,7 +199,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : // assume dirty m_ZoneFillsDirty = true; - m_aboutTitle = _( "KiCad PCB Editor" ); + m_aboutTitle = _HKI( "KiCad PCB Editor" ); // Must be created before the menus are created. if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist )