From bc773e02d336cd5d23e4e8eaa2b9896e47a45c5e Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 7 Mar 2018 14:48:11 -0500 Subject: [PATCH] Supply some missing translation in Macros dialogs... ... The "Set" prompt for checkboxes; Strings in Choice controls, which had been declared translatable with XO, but the translations not yet used. This can be tested in Ukrainian locale now, for editing parameters of commands like Select or Drag, but be aware that even uk.po is not up to date for all recent changes in the Manage Macros dialog itself. --- src/Internat.h | 15 +++++++++++++++ src/ShuttleGui.cpp | 3 ++- src/commands/DragCommand.cpp | 2 +- src/commands/GetInfoCommand.cpp | 4 ++-- src/commands/GetTrackInfoCommand.cpp | 2 +- src/commands/ScreenshotCommand.cpp | 4 ++-- src/commands/SelectCommand.cpp | 3 ++- src/commands/SetClipCommand.cpp | 2 +- src/commands/SetTrackInfoCommand.cpp | 8 ++++---- src/effects/nyquist/Nyquist.cpp | 11 +---------- src/effects/nyquist/Nyquist.h | 2 -- 11 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/Internat.h b/src/Internat.h index 7a57c117f..39d56f744 100644 --- a/src/Internat.h +++ b/src/Internat.h @@ -167,4 +167,19 @@ private: #define UTF8CTOWX(X) wxString((X), wxConvUTF8) #define LAT1CTOWX(X) wxString((X), wxConvISO8859_1) +inline wxArrayString LocalizedStrings(const wxString strings[], size_t nStrings) +{ + wxArrayString results; + std::transform( strings, strings + nStrings, std::back_inserter(results), + GetCustomTranslation ); + return results; +} + +inline wxArrayString LocalizedStrings(const wxArrayString &strings) +{ + if (strings.empty()) + return {}; + return LocalizedStrings( &strings[0], strings.size() ); +} + #endif diff --git a/src/ShuttleGui.cpp b/src/ShuttleGui.cpp index 4ec4aa5f8..43b210f49 100644 --- a/src/ShuttleGui.cpp +++ b/src/ShuttleGui.cpp @@ -2077,7 +2077,8 @@ ShuttleGui & ShuttleGui::Id(int id ) } ShuttleGui & ShuttleGui::Optional( bool &bVar ){ - TieCheckBox( "Set", bVar ); + /* i18n-hint verb, imperative */ + TieCheckBox( _("Set"), bVar ); return *this; }; diff --git a/src/commands/DragCommand.cpp b/src/commands/DragCommand.cpp index 15d223ea1..5b2350d19 100644 --- a/src/commands/DragCommand.cpp +++ b/src/commands/DragCommand.cpp @@ -61,7 +61,7 @@ bool DragCommand::DefineParams( ShuttleParams & S ){ void DragCommand::PopulateOrExchange(ShuttleGui & S) { - wxArrayString coords( nCoordTypes, kCoordTypeStrings ); + auto coords = LocalizedStrings( kCoordTypeStrings, nCoordTypes ); S.AddSpace(0, 5); diff --git a/src/commands/GetInfoCommand.cpp b/src/commands/GetInfoCommand.cpp index 19401616d..935d330c3 100644 --- a/src/commands/GetInfoCommand.cpp +++ b/src/commands/GetInfoCommand.cpp @@ -94,8 +94,8 @@ bool GetInfoCommand::DefineParams( ShuttleParams & S ){ void GetInfoCommand::PopulateOrExchange(ShuttleGui & S) { - wxArrayString types( nTypes, kTypes ); - wxArrayString formats( nFormats, kFormats ); + auto types = LocalizedStrings( kTypes, nTypes ); + auto formats = LocalizedStrings( kFormats, nFormats ); S.AddSpace(0, 5); S.StartMultiColumn(2, wxALIGN_CENTER); diff --git a/src/commands/GetTrackInfoCommand.cpp b/src/commands/GetTrackInfoCommand.cpp index b8eb5e9a6..e0480e313 100644 --- a/src/commands/GetTrackInfoCommand.cpp +++ b/src/commands/GetTrackInfoCommand.cpp @@ -48,7 +48,7 @@ bool GetTrackInfoCommand::DefineParams( ShuttleParams & S ){ void GetTrackInfoCommand::PopulateOrExchange(ShuttleGui & S) { - wxArrayString types( nTypes, kTypes ); + auto types = LocalizedStrings( kTypes, nTypes ); S.AddSpace(0, 5); S.StartMultiColumn(2, wxALIGN_CENTER); diff --git a/src/commands/ScreenshotCommand.cpp b/src/commands/ScreenshotCommand.cpp index f500ee719..2593b6853 100644 --- a/src/commands/ScreenshotCommand.cpp +++ b/src/commands/ScreenshotCommand.cpp @@ -148,8 +148,8 @@ bool ScreenshotCommand::DefineParams( ShuttleParams & S ){ void ScreenshotCommand::PopulateOrExchange(ShuttleGui & S) { - wxArrayString whats(nCaptureWhats, kCaptureWhatStrings); - wxArrayString backs(nBackgrounds, kBackgroundStrings); + auto whats = LocalizedStrings(kCaptureWhatStrings, nCaptureWhats); + auto backs = LocalizedStrings(kBackgroundStrings, nBackgrounds); S.AddSpace(0, 5); S.StartMultiColumn(2, wxALIGN_CENTER); diff --git a/src/commands/SelectCommand.cpp b/src/commands/SelectCommand.cpp index d0ab58331..86c98e08d 100644 --- a/src/commands/SelectCommand.cpp +++ b/src/commands/SelectCommand.cpp @@ -107,6 +107,7 @@ bool SelectFrequenciesCommand::Apply(const CommandContext & context){ const int nModes =3; static const wxString kModes[nModes] = { + /* i18n-hint verb, imperative */ XO("Set"), XO("Add"), XO("Remove") @@ -123,7 +124,7 @@ bool SelectTracksCommand::DefineParams( ShuttleParams & S ){ void SelectTracksCommand::PopulateOrExchange(ShuttleGui & S) { - wxArrayString modes( nModes, kModes ); + auto modes = LocalizedStrings( kModes, nModes ); S.AddSpace(0, 5); S.StartMultiColumn(3, wxALIGN_CENTER); diff --git a/src/commands/SetClipCommand.cpp b/src/commands/SetClipCommand.cpp index 731976edf..e45a71b3a 100644 --- a/src/commands/SetClipCommand.cpp +++ b/src/commands/SetClipCommand.cpp @@ -61,7 +61,7 @@ bool SetClipCommand::DefineParams( ShuttleParams & S ){ void SetClipCommand::PopulateOrExchange(ShuttleGui & S) { - wxArrayString colours( nColours, kColourStrings ); + auto colours = LocalizedStrings( kColourStrings, nColours ); S.AddSpace(0, 5); diff --git a/src/commands/SetTrackInfoCommand.cpp b/src/commands/SetTrackInfoCommand.cpp index d71e1e781..50a2aaed6 100644 --- a/src/commands/SetTrackInfoCommand.cpp +++ b/src/commands/SetTrackInfoCommand.cpp @@ -123,10 +123,10 @@ bool SetTrackCommand::DefineParams( ShuttleParams & S ){ void SetTrackCommand::PopulateOrExchange(ShuttleGui & S) { - wxArrayString colours( nColours, kColourStrings ); - wxArrayString displays( nDisplayTypes, kDisplayTypeStrings ); - wxArrayString scales( nScaleTypes, kScaleTypeStrings ); - wxArrayString vzooms( nZoomTypes, kZoomTypeStrings ); + auto colours = LocalizedStrings( kColourStrings, nColours ); + auto displays = LocalizedStrings( kDisplayTypeStrings, nDisplayTypes ); + auto scales = LocalizedStrings( kScaleTypeStrings, nScaleTypes ); + auto vzooms = LocalizedStrings( kZoomTypeStrings, nZoomTypes ); S.AddSpace(0, 5); diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index 97ffb9cae..fc59305de 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -94,15 +94,6 @@ enum static const wxChar *KEY_Version = wxT("Version"); static const wxChar *KEY_Command = wxT("Command"); -wxArrayString NyqControl::GetTranslatedChoices() const -{ - wxArrayString results; - std::transform( - choices.begin(), choices.end(), std::back_inserter(results), - GetCustomTranslation); - return results; -} - /////////////////////////////////////////////////////////////////////////////// // // NyquistEffect @@ -2405,7 +2396,7 @@ void NyquistEffect::BuildEffectWindow(ShuttleGui & S) { S.AddSpace(10, 10); - const wxArrayString &choices = ctrl.GetTranslatedChoices(); + auto choices = LocalizedStrings(ctrl.choices); S.Id(ID_Choice + i).AddChoice( {}, wxT(""), &choices); } else diff --git a/src/effects/nyquist/Nyquist.h b/src/effects/nyquist/Nyquist.h index d336584ae..dab4c5b12 100644 --- a/src/effects/nyquist/Nyquist.h +++ b/src/effects/nyquist/Nyquist.h @@ -53,8 +53,6 @@ public: //NyqControl( NyqControl && ) = default; //NyqControl &operator = ( NyqControl && ) = default; - wxArrayString GetTranslatedChoices() const; - int type; wxString var; wxString name;