From 89a3771730b041ad67d0966859eb0e04a2e2bd8f Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 18 Dec 2019 00:07:58 -0500 Subject: [PATCH] TranslatableString for AudacityTextEntryDialog message and caption --- src/BatchProcessDialog.cpp | 4 ++-- src/CrashReport.cpp | 10 +++++----- src/LabelDialog.cpp | 8 ++++---- src/effects/Equalization.cpp | 4 ++-- src/export/ExportMultiple.cpp | 14 ++++++++------ src/tracks/labeltrack/ui/LabelTrackView.cpp | 4 ++-- src/widgets/ErrorDialog.h | 9 +++++---- 7 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/BatchProcessDialog.cpp b/src/BatchProcessDialog.cpp index d94085b81..a54f7d348 100644 --- a/src/BatchProcessDialog.cpp +++ b/src/BatchProcessDialog.cpp @@ -965,8 +965,8 @@ void MacrosWindow::OnAdd(wxCommandEvent & WXUNUSED(event)) { while (true) { AudacityTextEntryDialog d(this, - _("Enter name of new macro"), - _("Name of new macro")); + XO("Enter name of new macro"), + XO("Name of new macro")); d.SetName(d.GetTitle()); wxString name; diff --git a/src/CrashReport.cpp b/src/CrashReport.cpp index f6294ff1f..7809957b3 100644 --- a/src/CrashReport.cpp +++ b/src/CrashReport.cpp @@ -59,11 +59,11 @@ void Generate(wxDebugReport::Context ctx) if (ok && rpt.Process()) { - AudacityTextEntryDialog dlg(NULL, - _("Report generated to:"), - _("Audacity Support Data"), - rpt.GetCompressedFileName(), - wxOK | wxCENTER); + AudacityTextEntryDialog dlg(nullptr, + XO("Report generated to:"), + XO("Audacity Support Data"), + rpt.GetCompressedFileName(), + wxOK | wxCENTER); dlg.SetName(dlg.GetTitle()); dlg.ShowModal(); diff --git a/src/LabelDialog.cpp b/src/LabelDialog.cpp index ab2520a70..cb3c94b28 100644 --- a/src/LabelDialog.cpp +++ b/src/LabelDialog.cpp @@ -812,10 +812,10 @@ void LabelDialog::OnChangeTrack(wxGridEvent & WXUNUSED(event), int row, RowData // User selected the "New..." choice so ask for a NEW name if ( make_iterator_range( mTrackNames ).index( val ) == 0 ) { AudacityTextEntryDialog d(this, - _("New Label Track"), - _("Enter track name"), - /* i18n-hint: (noun) it's the name of a kind of track.*/ - _("Label Track")); + XO("New Label Track"), + XO("Enter track name"), + /* i18n-hint: (noun) it's the name of a kind of track.*/ + XO("Label Track").Translation()); // User canceled so repopulating the grid will set the track // name to the orignal value diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index 8f516790b..d6f9273dd 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -3516,8 +3516,8 @@ void EditCurvesDialog::OnRename(wxCommandEvent & WXUNUSED(event)) bad = false; // build the dialog AudacityTextEntryDialog dlg( this, - wxString::Format( _("Rename '%s' to..."), mEditCurves[ item ].Name ), - _("Rename...") ); + XO("Rename '%s' to...").Format( mEditCurves[ item ].Name ), + XO("Rename...") ); dlg.SetTextValidator( wxFILTER_EXCLUDE_CHAR_LIST ); dlg.SetName( wxString::Format( _("Rename '%s'"), mEditCurves[ item ].Name ) ); diff --git a/src/export/ExportMultiple.cpp b/src/export/ExportMultiple.cpp index 6c1bd34e5..dc8ae0cc2 100644 --- a/src/export/ExportMultiple.cpp +++ b/src/export/ExportMultiple.cpp @@ -1111,20 +1111,22 @@ wxString ExportMultipleDialog::MakeFileName(const wxString &input) if(changed) { // need to get user to fix file name // build the dialog - wxString msg; + TranslatableString msg; wxString excluded = ::wxJoin( Internat::GetExcludedCharacters(), wxChar(' ') ); // TODO: For Russian langauge we should have separate cases for 2 and more than 2 letters. if( excluded.length() > 1 ){ // i18n-hint: The second %s gives some letters that can't be used. - msg.Printf(_("Label or track \"%s\" is not a legal file name. You cannot use any of: %s\nUse..."), input, - excluded); + msg = XO( +"Label or track \"%s\" is not a legal file name. You cannot use any of: %s\nUse...") + .Format( input, excluded ); } else { // i18n-hint: The second %s gives a letter that can't be used. - msg.Printf(_("Label or track \"%s\" is not a legal file name. You cannot use \"%s\".\nUse..."), input, - excluded); + msg = XO( +"Label or track \"%s\" is not a legal file name. You cannot use \"%s\".\nUse...") + .Format( input, excluded ); } - AudacityTextEntryDialog dlg( this, msg, _("Save As..."), newname ); + AudacityTextEntryDialog dlg( this, msg, XO("Save As..."), newname ); // And tell the validator about excluded chars diff --git a/src/tracks/labeltrack/ui/LabelTrackView.cpp b/src/tracks/labeltrack/ui/LabelTrackView.cpp index a69131eeb..d23fae862 100644 --- a/src/tracks/labeltrack/ui/LabelTrackView.cpp +++ b/src/tracks/labeltrack/ui/LabelTrackView.cpp @@ -2085,8 +2085,8 @@ int LabelTrackView::DialogForLabelName( position = trackPanel.ClientToScreen(position); auto &window = GetProjectFrame( project ); AudacityTextEntryDialog dialog{ &window, - _("Name:"), - _("New label"), + XO("Name:"), + XO("New label"), initialValue, wxOK | wxCANCEL, position }; diff --git a/src/widgets/ErrorDialog.h b/src/widgets/ErrorDialog.h index 6b57cc672..5b7f43ca8 100644 --- a/src/widgets/ErrorDialog.h +++ b/src/widgets/ErrorDialog.h @@ -69,13 +69,14 @@ class AudacityTextEntryDialog : public wxTabTraversalWrapper< wxTextEntryDialog public: AudacityTextEntryDialog( wxWindow *parent, - const wxString& message, - const wxString& caption, // don't use = wxGetTextFromUserPromptStr, + const TranslatableString& message, + const TranslatableString& caption, // don't use = wxGetTextFromUserPromptStr, const wxString& value = {}, long style = wxTextEntryDialogStyle, const wxPoint& pos = wxDefaultPosition) - : wxTabTraversalWrapper< wxTextEntryDialog> - ( parent, message, caption, value, style, pos ) + : wxTabTraversalWrapper< wxTextEntryDialog>( + parent, + message.Translation(), caption.Translation(), value, style, pos ) {} void SetInsertionPointEnd();