From c23451af9dd0d7042690327a44cff72e39845e59 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Mon, 23 Dec 2019 18:02:44 -0500 Subject: [PATCH] TranslatableString for prompts of radio buttons --- src/PluginManager.cpp | 8 ++++---- src/ShuttleGui.cpp | 11 ++++++----- src/ShuttleGui.h | 6 +++--- src/effects/Equalization.cpp | 14 +++++++------- src/effects/NoiseReduction.cpp | 6 +++--- src/effects/NoiseRemoval.cpp | 4 ++-- src/export/ExportMultiple.cpp | 4 ++-- src/import/ImportPCM.cpp | 4 ++-- src/widgets/Meter.cpp | 14 +++++++------- 9 files changed, 36 insertions(+), 35 deletions(-) diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index b022f4a50..a75644e6f 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -536,7 +536,7 @@ void PluginRegistrationDialog::PopulateOrExchange(ShuttleGui &S) /* i18n-hint: Radio button to show all effects */ .Name(XO("Show all")) /* i18n-hint: Radio button to show all effects */ - .AddRadioButton(_("&All")); + .AddRadioButton(XO("&All")); #if wxUSE_ACCESSIBILITY // so that name can be set on a standard control rb->SetAccessible(safenew WindowAccessible(rb)); @@ -546,7 +546,7 @@ void PluginRegistrationDialog::PopulateOrExchange(ShuttleGui &S) /* i18n-hint: Radio button to show just the currently disabled effects */ .Name(XO("Show disabled")) /* i18n-hint: Radio button to show just the currently disabled effects */ - .AddRadioButtonToGroup(_("D&isabled")); + .AddRadioButtonToGroup(XO("D&isabled")); #if wxUSE_ACCESSIBILITY // so that name can be set on a standard control rb->SetAccessible(safenew WindowAccessible(rb)); @@ -556,7 +556,7 @@ void PluginRegistrationDialog::PopulateOrExchange(ShuttleGui &S) /* i18n-hint: Radio button to show just the currently enabled effects */ .Name(XO("Show enabled")) /* i18n-hint: Radio button to show just the currently enabled effects */ - .AddRadioButtonToGroup(_("E&nabled")); + .AddRadioButtonToGroup(XO("E&nabled")); #if wxUSE_ACCESSIBILITY // so that name can be set on a standard control rb->SetAccessible(safenew WindowAccessible(rb)); @@ -566,7 +566,7 @@ void PluginRegistrationDialog::PopulateOrExchange(ShuttleGui &S) /* i18n-hint: Radio button to show just the newly discovered effects */ .Name(XO("Show new")) /* i18n-hint: Radio button to show just the newly discovered effects */ - .AddRadioButtonToGroup(_("Ne&w")); + .AddRadioButtonToGroup(XO("Ne&w")); #if wxUSE_ACCESSIBILITY // so that name can be set on a standard control rb->SetAccessible(safenew WindowAccessible(rb)); diff --git a/src/ShuttleGui.cpp b/src/ShuttleGui.cpp index 9eafc3d6c..575e69ccc 100644 --- a/src/ShuttleGui.cpp +++ b/src/ShuttleGui.cpp @@ -514,17 +514,18 @@ wxComboBox * ShuttleGuiBase::AddCombo( wxRadioButton * ShuttleGuiBase::DoAddRadioButton( - const wxString &Prompt, int style, int selector, int initValue) + const TranslatableString &Prompt, int style, int selector, int initValue) { + const auto translated = Prompt.Translation(); /// \todo This function and the next two, suitably adapted, could be /// used by TieRadioButton. UseUpId(); if( mShuttleMode != eIsCreating ) return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxRadioButton); wxRadioButton * pRad; - mpWind = pRad = safenew wxRadioButton(GetParent(), miId, Prompt, + mpWind = pRad = safenew wxRadioButton(GetParent(), miId, translated, wxDefaultPosition, wxDefaultSize, GetStyle( style ) ); - mpWind->SetName(wxStripMenuCodes(Prompt)); + mpWind->SetName(wxStripMenuCodes(translated)); if ( style ) pRad->SetValue( true ); UpdateSizers(); @@ -533,13 +534,13 @@ wxRadioButton * ShuttleGuiBase::DoAddRadioButton( } wxRadioButton * ShuttleGuiBase::AddRadioButton( - const wxString &Prompt, int selector, int initValue) + const TranslatableString &Prompt, int selector, int initValue) { return DoAddRadioButton( Prompt, wxRB_GROUP, selector, initValue ); } wxRadioButton * ShuttleGuiBase::AddRadioButtonToGroup( - const wxString &Prompt, int selector, int initValue) + const TranslatableString &Prompt, int selector, int initValue) { return DoAddRadioButton( Prompt, 0, selector, initValue ); } diff --git a/src/ShuttleGui.h b/src/ShuttleGui.h index 1eb733b58..263ba6474 100644 --- a/src/ShuttleGui.h +++ b/src/ShuttleGui.h @@ -283,9 +283,9 @@ public: // Spoken name of the button defaults to the same as the prompt // (after stripping menu codes): wxRadioButton * AddRadioButton( - const wxString & Prompt, int selector = 0, int initValue = 0 ); + const TranslatableString & Prompt, int selector = 0, int initValue = 0 ); wxRadioButton * AddRadioButtonToGroup( - const wxString & Prompt, int selector = 1, int initValue = 0 ); + const TranslatableString & Prompt, int selector = 1, int initValue = 0 ); // Only the last button specified as default (if more than one) will be // Always ORs the flags with wxALL (which affects borders): @@ -578,7 +578,7 @@ private: int mRadioCount; /// The index of this radio item. -1 for none. wxString mRadioValueString; /// Unwrapped string value. wxRadioButton * DoAddRadioButton( - const wxString &Prompt, int style, int selector, int initValue); + const TranslatableString &Prompt, int style, int selector, int initValue); protected: DialogDefinition::Item mItem; diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index 54fafe436..f85d97d3d 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -924,11 +924,11 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S) { mDraw = S.Id(ID_Draw) .Name(XO("Draw Curves")) - .AddRadioButton(_("&Draw")); + .AddRadioButton(XO("&Draw")); mGraphic = S.Id(ID_Graphic) .Name(XO("Graphic EQ")) - .AddRadioButtonToGroup(_("&Graphic")); + .AddRadioButtonToGroup(XO("&Graphic")); } S.EndHorizontalLay(); } @@ -1081,25 +1081,25 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S) : 0; mMathProcessingType[0] = S.Id(ID_DefaultMath) - .AddRadioButton(_("D&efault"), + .AddRadioButton(XO("D&efault"), 0, value); mMathProcessingType[1] = S.Id(ID_SSE) .Disable(!EffectEqualization48x::GetMathCaps()->SSE) - .AddRadioButtonToGroup(_("&SSE"), + .AddRadioButtonToGroup(XO("&SSE"), 1, value); mMathProcessingType[2] = S.Id(ID_SSEThreaded) .Disable(!EffectEqualization48x::GetMathCaps()->SSE) - .AddRadioButtonToGroup(_("SSE &Threaded"), + .AddRadioButtonToGroup(XO("SSE &Threaded"), 2, value); mMathProcessingType[3] = S.Id(ID_AVX) // not implemented .Disable(true /* !EffectEqualization48x::GetMathCaps()->AVX */) - .AddRadioButtonToGroup(_("A&VX"), + .AddRadioButtonToGroup(XO("A&VX"), 3, value); mMathProcessingType[4] = S.Id(ID_AVXThreaded) // not implemented .Disable(true /* !EffectEqualization48x::GetMathCaps()->AVX */) - .AddRadioButtonToGroup(_("AV&X Threaded"), + .AddRadioButtonToGroup(XO("AV&X Threaded"), 4, value); S.Id(ID_Bench).AddButton(XO("&Bench")); } diff --git a/src/effects/NoiseReduction.cpp b/src/effects/NoiseReduction.cpp index d914a5723..3aca7a441 100644 --- a/src/effects/NoiseReduction.cpp +++ b/src/effects/NoiseReduction.cpp @@ -1742,14 +1742,14 @@ void EffectNoiseReduction::Dialog::PopulateOrExchange(ShuttleGui & S) { S.AddPrompt(_("Noise:")); mKeepSignal = S.Id(ID_RADIOBUTTON_KEEPSIGNAL) - .AddRadioButton(_("Re&duce")); /* i18n-hint: Translate differently from "Residue" ! */ + .AddRadioButton(XO("Re&duce")); /* i18n-hint: Translate differently from "Residue" ! */ #ifdef ISOLATE_CHOICE mKeepNoise = S.Id(ID_RADIOBUTTON_KEEPNOISE) - .AddRadioButtonToGroup(_("&Isolate")); + .AddRadioButtonToGroup(XO("&Isolate")); #endif #ifdef RESIDUE_CHOICE mResidue = S.Id(ID_RADIOBUTTON_RESIDUE) - .AddRadioButtonToGroup(_("Resid&ue")); /* i18n-hint: Means the difference between effect and original sound. Translate differently from "Reduce" ! */ + .AddRadioButtonToGroup(XO("Resid&ue")); /* i18n-hint: Means the difference between effect and original sound. Translate differently from "Reduce" ! */ #endif } S.EndMultiColumn(); diff --git a/src/effects/NoiseRemoval.cpp b/src/effects/NoiseRemoval.cpp index 0133edd5d..e9e81f340 100644 --- a/src/effects/NoiseRemoval.cpp +++ b/src/effects/NoiseRemoval.cpp @@ -758,9 +758,9 @@ void NoiseRemovalDialog::PopulateOrExchange(ShuttleGui & S) S.AddPrompt(_("Noise:")); mKeepSignal = S.Id(ID_RADIOBUTTON_KEEPSIGNAL) - .AddRadioButton(_("Re&move")); + .AddRadioButton(XO("Re&move")); mKeepNoise = S.Id(ID_RADIOBUTTON_KEEPNOISE) - .AddRadioButtonToGroup(_("&Isolate")); + .AddRadioButtonToGroup(XO("&Isolate")); } S.EndMultiColumn(); } diff --git a/src/export/ExportMultiple.cpp b/src/export/ExportMultiple.cpp index 749354b6c..8a7354b06 100644 --- a/src/export/ExportMultiple.cpp +++ b/src/export/ExportMultiple.cpp @@ -334,12 +334,12 @@ void ExportMultipleDialog::PopulateOrExchange(ShuttleGui& S) // Row 1 S.SetBorder(1); mTrack = S.Id(TrackID) - .AddRadioButton(_("Tracks")); + .AddRadioButton(XO("Tracks")); // Row 2 S.SetBorder(1); mLabel = S.Id(LabelID) - .AddRadioButtonToGroup(_("Labels")); + .AddRadioButtonToGroup(XO("Labels")); S.SetBorder(3); S.StartMultiColumn(2, wxEXPAND); diff --git a/src/import/ImportPCM.cpp b/src/import/ImportPCM.cpp index 561b4ecba..e870674d3 100644 --- a/src/import/ImportPCM.cpp +++ b/src/import/ImportPCM.cpp @@ -355,10 +355,10 @@ static wxString AskCopyOrEdit() S.SetBorder(0); copyRadio = S.AddRadioButton( - _("Make a © of the files before editing (safer)") ); + XO("Make a © of the files before editing (safer)") ); aliasRadio = S.AddRadioButtonToGroup( - _("Read the files &directly from the original (faster)") ); + XO("Read the files &directly from the original (faster)") ); dontAskNextTimeBox = S.AddCheckBox( _("Don't &warn again and always use my choice above"), diff --git a/src/widgets/Meter.cpp b/src/widgets/Meter.cpp index ea62f7ebb..7d8d8ae8d 100644 --- a/src/widgets/Meter.cpp +++ b/src/widgets/Meter.cpp @@ -2024,8 +2024,8 @@ void MeterPanel::OnPreferences(wxCommandEvent & WXUNUSED(event)) { S.StartVerticalLay(); { - gradient = S.AddRadioButton(_("Gradient"), true, mGradient); - rms = S.AddRadioButtonToGroup(_("RMS"), false, mGradient); + gradient = S.AddRadioButton(XO("Gradient"), true, mGradient); + rms = S.AddRadioButtonToGroup(XO("RMS"), false, mGradient); } S.EndVerticalLay(); } @@ -2035,8 +2035,8 @@ void MeterPanel::OnPreferences(wxCommandEvent & WXUNUSED(event)) { S.StartVerticalLay(); { - db = S.AddRadioButton(_("dB"), true, mDB); - linear = S.AddRadioButtonToGroup(_("Linear"), false, mDB); + db = S.AddRadioButton(XO("dB"), true, mDB); + linear = S.AddRadioButtonToGroup(XO("Linear"), false, mDB); } S.EndVerticalLay(); } @@ -2047,11 +2047,11 @@ void MeterPanel::OnPreferences(wxCommandEvent & WXUNUSED(event)) S.StartVerticalLay(); { automatic = S.AddRadioButton( - _("Automatic"), AutomaticStereo, mDesiredStyle); + XO("Automatic"), AutomaticStereo, mDesiredStyle); horizontal = S.AddRadioButtonToGroup( - _("Horizontal"), HorizontalStereo, mDesiredStyle); + XO("Horizontal"), HorizontalStereo, mDesiredStyle); vertical = S.AddRadioButtonToGroup( - _("Vertical"), VerticalStereo, mDesiredStyle); + XO("Vertical"), VerticalStereo, mDesiredStyle); } S.EndVerticalLay(); }