From 7c94983758ac05f9b12cf11b96a5f4253eb1d6af Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 30 Oct 2020 12:48:22 -0700 Subject: [PATCH] Fix translation issue We cannot use verb-based substitution in translated strings --- .../dialogs/dialog_configure_paths_base.fbp | 1 - pcbnew/dialogs/dialog_exchange_footprints.cpp | 51 +++++++------------ .../dialog_exchange_footprints_base.cpp | 20 ++++---- .../dialog_exchange_footprints_base.fbp | 20 ++++---- .../dialogs/dialog_exchange_footprints_base.h | 4 +- 5 files changed, 41 insertions(+), 55 deletions(-) diff --git a/common/dialogs/dialog_configure_paths_base.fbp b/common/dialogs/dialog_configure_paths_base.fbp index 2626a392e2..cb3b3c4885 100644 --- a/common/dialogs/dialog_configure_paths_base.fbp +++ b/common/dialogs/dialog_configure_paths_base.fbp @@ -53,7 +53,6 @@ - OnWindowSize OnUpdateUI diff --git a/pcbnew/dialogs/dialog_exchange_footprints.cpp b/pcbnew/dialogs/dialog_exchange_footprints.cpp index 83d5dfe8a4..f811527d88 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.cpp +++ b/pcbnew/dialogs/dialog_exchange_footprints.cpp @@ -65,17 +65,22 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, m_currentFootprint( aFootprint ), m_updateMode( updateMode ) { - wxString title = updateMode ? _( "Update Footprints from Library" ) : _( "Change Footprints" ); - wxString verb = updateMode ? _( "Update" ) : _( "Change" ); - wxString reset = updateMode ? _( "Reset" ) : _( "Update" ); - wxString label; - - SetTitle( title ); + if( !updateMode ) + { + SetTitle( _( "Change Footprints" ) ); + m_matchAll->SetLabel( _( "Change all footprints on board" ) ); + m_matchSelected->SetLabel( _( "Change selected footprint" ) ); + m_matchSpecifiedRef->SetLabel( _( "Change footprints matching reference designator:" ) ); + m_matchSpecifiedValue->SetLabel( _( "Change footprints matching value:" ) ); + m_matchSpecifiedID->SetLabel( _( "Change footprints with library id:" ) ); + m_resetTextItemLayers->SetLabel( _( "Update text layers and visibilities" ) ); + m_resetTextItemEffects->SetLabel( _( "Update text sizes, styles and positions" ) ); + m_resetFabricationAttrs->SetLabel( _( "Update fabrications attributes" ) ); + m_reset3DModels->SetLabel( _( "Update 3D models" ) ); + } if( m_updateMode ) { - label.Printf( m_matchAll->GetLabel(), verb ); - m_matchAll->SetLabel( label ); m_changeSizer->Show( false ); } else @@ -86,29 +91,18 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, if( m_currentFootprint ) { - label.Printf( m_matchSelected->GetLabel(), verb ); - m_matchSelected->SetLabel( label ); m_newID->AppendText( FROM_UTF8( m_currentFootprint->GetFPID().Format().c_str() ) ); } else m_upperSizer->FindItem( m_matchSelected )->Show( false ); - label.Printf( m_matchSpecifiedRef->GetLabel(), verb ); - m_matchSpecifiedRef->SetLabel( label ); - // Use ChangeValue() instead of SetValue() so we don't generate events. if( m_currentFootprint ) m_specifiedRef->ChangeValue( m_currentFootprint->GetReference() ); - label.Printf( m_matchSpecifiedValue->GetLabel(), verb ); - m_matchSpecifiedValue->SetLabel( label ); - if( m_currentFootprint ) m_specifiedValue->ChangeValue( m_currentFootprint->GetValue() ); - label.Printf( m_matchSpecifiedID->GetLabel(), verb ); - m_matchSpecifiedID->SetLabel( label ); - if( m_currentFootprint ) m_specifiedID->ChangeValue( FROM_UTF8( m_currentFootprint->GetFPID().Format().c_str() ) ); @@ -137,18 +131,6 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, default: break; } - label.Printf( m_resetTextItemLayers->GetLabel(), reset ); - m_resetTextItemLayers->SetLabel( label ); - - label.Printf( m_resetTextItemEffects->GetLabel(), reset ); - m_resetTextItemEffects->SetLabel( label ); - - label.Printf( m_resetFabricationAttrs->GetLabel(), reset ); - m_resetFabricationAttrs->SetLabel( label ); - - label.Printf( m_reset3DModels->GetLabel(), reset ); - m_reset3DModels->SetLabel( label ); - m_removeExtraBox->SetValue( g_removeExtraTextItems[ m_updateMode ? 0 : 1 ] ); m_resetTextItemLayers->SetValue( g_resetTextItemLayers[ m_updateMode ? 0 : 1 ] ); m_resetTextItemEffects->SetValue( g_resetTextItemEffects[ m_updateMode ? 0 : 1 ] ); @@ -164,7 +146,12 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, // Ensure m_closeButton (with id = wxID_CANCEL) has the right label // (to fix automatic renaming of button label ) m_sdbSizerCancel->SetLabel( _( "Close" ) ); - m_sdbSizerOK->SetLabel( verb ); + + if( m_updateMode ) + m_sdbSizerOK->SetLabel( _( "Update" ) ); + else + m_sdbSizerOK->SetLabel( _( "Change" ) ); + m_sdbSizerOK->SetDefault(); // Now all widgets have the size fixed, call FinishDialogSettings diff --git a/pcbnew/dialogs/dialog_exchange_footprints_base.cpp b/pcbnew/dialogs/dialog_exchange_footprints_base.cpp index 6daea12a46..24d8141b6e 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints_base.cpp +++ b/pcbnew/dialogs/dialog_exchange_footprints_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 26 2018) +// C++ code generated with wxFormBuilder (version 3.9.0 Jul 27 2020) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -21,13 +21,13 @@ DIALOG_EXCHANGE_FOOTPRINTS_BASE::DIALOG_EXCHANGE_FOOTPRINTS_BASE( wxWindow* pare m_upperSizer->SetFlexibleDirection( wxBOTH ); m_upperSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_matchAll = new wxRadioButton( this, wxID_ANY, _("%s all footprints on board"), wxDefaultPosition, wxDefaultSize, 0 ); + m_matchAll = new wxRadioButton( this, wxID_ANY, _("Update all footprints on board"), wxDefaultPosition, wxDefaultSize, 0 ); m_upperSizer->Add( m_matchAll, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxEXPAND|wxALL, 5 ); - m_matchSelected = new wxRadioButton( this, wxID_ANY, _("%s selected footprint"), wxDefaultPosition, wxDefaultSize, 0 ); + m_matchSelected = new wxRadioButton( this, wxID_ANY, _("Update selected footprint"), wxDefaultPosition, wxDefaultSize, 0 ); m_upperSizer->Add( m_matchSelected, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 ); - m_matchSpecifiedRef = new wxRadioButton( this, wxID_ANY, _("%s footprints matching reference designator:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_matchSpecifiedRef = new wxRadioButton( this, wxID_ANY, _("Update footprints matching reference designator:"), wxDefaultPosition, wxDefaultSize, 0 ); m_upperSizer->Add( m_matchSpecifiedRef, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); m_specifiedRef = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); @@ -35,13 +35,13 @@ DIALOG_EXCHANGE_FOOTPRINTS_BASE::DIALOG_EXCHANGE_FOOTPRINTS_BASE( wxWindow* pare m_upperSizer->Add( m_specifiedRef, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxTOP|wxEXPAND, 5 ); - m_matchSpecifiedValue = new wxRadioButton( this, wxID_ANY, _("%s footprints matching value:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_matchSpecifiedValue = new wxRadioButton( this, wxID_ANY, _("Update footprints matching value:"), wxDefaultPosition, wxDefaultSize, 0 ); m_upperSizer->Add( m_matchSpecifiedValue, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALL, 5 ); m_specifiedValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); m_upperSizer->Add( m_specifiedValue, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 ); - m_matchSpecifiedID = new wxRadioButton( this, wxID_ANY, _("%s footprints with library id:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_matchSpecifiedID = new wxRadioButton( this, wxID_ANY, _("Update footprints with library id:"), wxDefaultPosition, wxDefaultSize, 0 ); m_upperSizer->Add( m_matchSpecifiedID, wxGBPosition( 4, 0 ), wxGBSpan( 1, 2 ), wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 5 ); @@ -98,16 +98,16 @@ DIALOG_EXCHANGE_FOOTPRINTS_BASE::DIALOG_EXCHANGE_FOOTPRINTS_BASE( wxWindow* pare m_updateOptionsSizer->Add( m_removeExtraBox, 0, wxBOTTOM|wxRIGHT, 5 ); - m_resetTextItemLayers = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("%s text layers and visibilities"), wxDefaultPosition, wxDefaultSize, 0 ); + m_resetTextItemLayers = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset text layers and visibilities"), wxDefaultPosition, wxDefaultSize, 0 ); m_updateOptionsSizer->Add( m_resetTextItemLayers, 0, wxBOTTOM|wxRIGHT, 5 ); - m_resetTextItemEffects = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("%s text sizes, styles and positions"), wxDefaultPosition, wxDefaultSize, 0 ); + m_resetTextItemEffects = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset text sizes, styles and positions"), wxDefaultPosition, wxDefaultSize, 0 ); m_updateOptionsSizer->Add( m_resetTextItemEffects, 0, wxBOTTOM|wxRIGHT, 5 ); - m_resetFabricationAttrs = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("%s fabrication attributes"), wxDefaultPosition, wxDefaultSize, 0 ); + m_resetFabricationAttrs = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset fabrication attributes"), wxDefaultPosition, wxDefaultSize, 0 ); m_updateOptionsSizer->Add( m_resetFabricationAttrs, 0, wxBOTTOM|wxRIGHT, 5 ); - m_reset3DModels = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("%s 3D models"), wxDefaultPosition, wxDefaultSize, 0 ); + m_reset3DModels = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset 3D models"), wxDefaultPosition, wxDefaultSize, 0 ); m_updateOptionsSizer->Add( m_reset3DModels, 0, wxBOTTOM|wxRIGHT, 5 ); diff --git a/pcbnew/dialogs/dialog_exchange_footprints_base.fbp b/pcbnew/dialogs/dialog_exchange_footprints_base.fbp index f3d288b54d..062cb1da61 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints_base.fbp +++ b/pcbnew/dialogs/dialog_exchange_footprints_base.fbp @@ -48,7 +48,7 @@ -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h - %s + Update Footprints from Library @@ -109,7 +109,7 @@ 0 0 wxID_ANY - %s all footprints on board + Update all footprints on board 0 @@ -177,7 +177,7 @@ 0 0 wxID_ANY - %s selected footprint + Update selected footprint 0 @@ -245,7 +245,7 @@ 0 0 wxID_ANY - %s footprints matching reference designator: + Update footprints matching reference designator: 0 @@ -382,7 +382,7 @@ 0 0 wxID_ANY - %s footprints matching value: + Update footprints matching value: 0 @@ -519,7 +519,7 @@ 0 0 wxID_ANY - %s footprints with library id: + Update footprints with library id: 0 @@ -1091,7 +1091,7 @@ 0 0 wxID_ANY - %s text layers and visibilities + Reset text layers and visibilities 0 @@ -1155,7 +1155,7 @@ 0 0 wxID_ANY - %s text sizes, styles and positions + Reset text sizes, styles and positions 0 @@ -1219,7 +1219,7 @@ 0 0 wxID_ANY - %s fabrication attributes + Reset fabrication attributes 0 @@ -1283,7 +1283,7 @@ 0 0 wxID_ANY - %s 3D models + Reset 3D models 0 diff --git a/pcbnew/dialogs/dialog_exchange_footprints_base.h b/pcbnew/dialogs/dialog_exchange_footprints_base.h index b469ced655..403f30207a 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints_base.h +++ b/pcbnew/dialogs/dialog_exchange_footprints_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 26 2018) +// C++ code generated with wxFormBuilder (version 3.9.0 Jul 27 2020) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -83,7 +83,7 @@ class DIALOG_EXCHANGE_FOOTPRINTS_BASE : public DIALOG_SHIM public: - DIALOG_EXCHANGE_FOOTPRINTS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("%s"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_EXCHANGE_FOOTPRINTS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Update Footprints from Library"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_EXCHANGE_FOOTPRINTS_BASE(); };