diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index a47e1d8ee..b8085d18d 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -1056,7 +1056,7 @@ void AudacityApp::OnTimer(wxTimerEvent& WXUNUSED(event)) window.Iconize(false); window.Raise(); - wxString errorMessage = wxString::Format(_( + auto errorMessage = XO( "One or more external audio files could not be found.\n\ It is possible they were moved, deleted, or the drive they \ were on was unmounted.\n\ @@ -1065,7 +1065,7 @@ The first detected missing file is:\n\ %s\n\ There may be additional missing files.\n\ Choose Help > Diagnostics > Check Dependencies to view a list of \ -locations of the missing files."), missingFileName); +locations of the missing files.").Format( missingFileName ) ; // if an old dialog exists, raise it if it is if ( auto dialog = MissingAliasFilesDialog::Find( *offendingProject ) ) diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp index 6cf1ef2e2..b279171ad 100644 --- a/src/AudioIO.cpp +++ b/src/AudioIO.cpp @@ -1435,7 +1435,8 @@ void AudioIO::StartMonitoring( const AudioIOStartStreamOptions &options ) captureFormat); if (!success) { - wxString msg = wxString::Format(_("Error opening recording device.\nError code: %s"), Get()->LastPaErrorString()); + auto msg = XO("Error opening recording device.\nError code: %s") + .Format( Get()->LastPaErrorString() ); ShowErrorDialog( FindProjectFrame( mOwningProject ), XO("Error"), msg, wxT("Error_opening_sound_device")); return; diff --git a/src/DirManager.cpp b/src/DirManager.cpp index 1bf045782..04c6a802e 100644 --- a/src/DirManager.cpp +++ b/src/DirManager.cpp @@ -432,7 +432,7 @@ DirManager::DirManager() if (wxGetDiskSpace(globaltemp, NULL, &freeSpace)) { if (freeSpace < wxLongLong(wxLL(100 * 1048576))) { ShowWarningDialog(NULL, wxT("DiskSpaceWarning"), - _("There is very little free disk space left on this volume.\nPlease select another temporary directory in Preferences.")); + XO("There is very little free disk space left on this volume.\nPlease select another temporary directory in Preferences.")); } } } diff --git a/src/Menus.cpp b/src/Menus.cpp index 2f184b02d..002c58c2f 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -737,6 +737,6 @@ void MenuManager::TellUserWhyDisallowed( ShowErrorDialog( NULL, untranslatedTitle, - reason.Translation(), + reason, helpPage); } diff --git a/src/MissingAliasFileDialog.cpp b/src/MissingAliasFileDialog.cpp index 4a9c534d0..0d07d5af7 100644 --- a/src/MissingAliasFileDialog.cpp +++ b/src/MissingAliasFileDialog.cpp @@ -26,7 +26,7 @@ class MissingAliasFileDialog final : public ErrorDialog public: MissingAliasFileDialog(wxWindow *parent, const TranslatableString & dlogTitle, - const wxString & message, + const TranslatableString & message, const wxString & helpURL, const bool Close = true, const bool modal = true); virtual ~MissingAliasFileDialog(); @@ -35,7 +35,7 @@ class MissingAliasFileDialog final : public ErrorDialog MissingAliasFileDialog::MissingAliasFileDialog(wxWindow *parent, const TranslatableString & dlogTitle, - const wxString & message, + const TranslatableString & message, const wxString & helpURL, const bool Close, const bool modal) : ErrorDialog( parent, @@ -66,7 +66,7 @@ namespace MissingAliasFilesDialog { void Show(AudacityProject *project, const TranslatableString &dlogTitle, - const wxString &message, + const TranslatableString &message, const wxString &helpPage, const bool Close) { diff --git a/src/MissingAliasFileDialog.h b/src/MissingAliasFileDialog.h index bbd8ad6c4..ae4179721 100644 --- a/src/MissingAliasFileDialog.h +++ b/src/MissingAliasFileDialog.h @@ -5,6 +5,7 @@ class AliasBlockFile; class AudacityProject; class TranslatableString; class wxDialog; +class TranslatableString; #include #include @@ -34,7 +35,7 @@ bool ShouldShow(); /// Displays a custom modeless error dialog for aliased file errors void Show(AudacityProject *parent, const TranslatableString &dlogTitle, - const wxString &message, + const TranslatableString &message, const wxString &helpPage, const bool Close = true); diff --git a/src/ProjectAudioManager.cpp b/src/ProjectAudioManager.cpp index 48a28433c..697fbdf28 100644 --- a/src/ProjectAudioManager.cpp +++ b/src/ProjectAudioManager.cpp @@ -259,7 +259,7 @@ int ProjectAudioManager::PlayPlayRegion(const SelectedRegion &selectedRegion, window.CallAfter( [&]{ // Show error message if stream could not be opened ShowErrorDialog(&window, XO("Error"), - _("Error opening sound device.\nTry changing the audio host, playback device and the project sample rate."), + XO("Error opening sound device.\nTry changing the audio host, playback device and the project sample rate."), wxT("Error_opening_sound_device")); }); } @@ -711,7 +711,8 @@ bool ProjectAudioManager::DoRecord(AudacityProject &project, CancelRecording(); // Show error message if stream could not be opened - wxString msg = wxString::Format(_("Error opening recording device.\nError code: %s"), gAudioIO->LastPaErrorString()); + auto msg = XO("Error opening recording device.\nError code: %s") + .Format( gAudioIO->LastPaErrorString() ); ShowErrorDialog(&GetProjectFrame( mProject ), XO("Error"), msg, wxT("Error_opening_sound_device")); } @@ -858,7 +859,7 @@ void ProjectAudioManager::OnAudioIOStopRecording() SelectedRegion{ interval.first, interval.first + interval.second }, wxString::Format(wxT("%ld"), counter++)); - ShowWarningDialog(&window, wxT("DropoutDetected"), _("\ + ShowWarningDialog(&window, wxT("DropoutDetected"), XO("\ Recorded audio was lost at the labeled locations. Possible causes:\n\ \n\ Other applications are competing with Audacity for processor time\n\ @@ -867,7 +868,7 @@ You are saving directly to a slow external storage device\n\ " ), false, - _("Turn off dropout detection")); + XO("Turn off dropout detection")); } auto &history = ProjectHistory::Get( project ); diff --git a/src/ProjectFileManager.cpp b/src/ProjectFileManager.cpp index 3d0d51029..cad46818e 100644 --- a/src/ProjectFileManager.cpp +++ b/src/ProjectFileManager.cpp @@ -798,14 +798,14 @@ bool ProjectFileManager::SaveAs(bool bWantSaveCopy /*= false*/, bool bLossless / } TranslatableString title; - wxString message; + TranslatableString message; if (bWantSaveCopy) { if (bLossless) { title = XO("%sSave Lossless Copy of Project \"%s\" As...") .Format( Restorer.sProjNumber,Restorer.sProjName ); - message = _("\ + message = XO("\ 'Save Lossless Copy of Project' is for an Audacity project, not an audio file.\n\ For an audio file that will open in other apps, use 'Export'.\n\n\ \ @@ -816,7 +816,7 @@ with no loss of quality, but the projects are large.\n"); { title = XO("%sSave Compressed Copy of Project \"%s\" As...") .Format( Restorer.sProjNumber, Restorer.sProjName ); - message = _("\ + message = XO("\ 'Save Compressed Copy of Project' is for an Audacity project, not an audio file.\n\ For an audio file that will open in other apps, use 'Export'.\n\n\ \ @@ -828,7 +828,7 @@ but they have some loss of fidelity.\n"); { title = XO("%sSave Project \"%s\" As...") .Format( Restorer.sProjNumber, Restorer.sProjName ); - message = _("\ + message = XO("\ 'Save Project' is for an Audacity project, not an audio file.\n\ For an audio file that will open in other apps, use 'Export'.\n"); } @@ -1561,7 +1561,7 @@ void ProjectFileManager::OpenFile(const FilePath &fileNameArg, bool addtohistory ShowErrorDialog( &window, XO("Error Opening Project"), - errorStr.Translation(), + errorStr, results.helpUrl); } } @@ -1703,7 +1703,7 @@ bool ProjectFileManager::Import( // Error message derived from Importer::Import // Additional help via a Help button links to the manual. ShowErrorDialog(&GetProjectFrame( project ), XO("Error Importing"), - errorMessage.Translation(), wxT("Importing_Audio")); + errorMessage, wxT("Importing_Audio")); } if (!success) return false; diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index c45a8fd5f..1c75b71e8 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -2441,7 +2441,7 @@ void Effect::Preview(bool dryOnly) } else { ShowErrorDialog(FocusDialog, XO("Error"), - _("Error opening sound device.\nTry changing the audio host, playback device and the project sample rate."), + XO("Error opening sound device.\nTry changing the audio host, playback device and the project sample rate."), wxT("Error_opening_sound_device")); } } diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index 2a270bb8e..8f516790b 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -1777,9 +1777,9 @@ bool EffectEqualization::GetDefaultFileName(wxFileName &fileName) if( !fileName.FileExists() ) { // LLL: Is there really a need for an error message at all??? - //wxString errorMessage; - //errorMessage.Printf(_("EQCurves.xml and EQDefaultCurves.xml were not found on your system.\nPlease press 'help' to visit the download page.\n\nSave the curves at %s"), FileNames::DataDir()); - //ShowErrorDialog(mUIParent, _("EQCurves.xml and EQDefaultCurves.xml missing"), + //auto errorMessage = XO("EQCurves.xml and EQDefaultCurves.xml were not found on your system.\nPlease press 'help' to visit the download page.\n\nSave the curves at %s") + // .Format( FileNames::DataDir() ); + //ShowErrorDialog(mUIParent, XO("EQCurves.xml and EQDefaultCurves.xml missing"), // errorMessage, wxT("http://wiki.audacityteam.org/wiki/EQCurvesDownload"), false); // Have another go at finding EQCurves.xml in the data dir, in case 'help' helped diff --git a/src/export/Export.cpp b/src/export/Export.cpp index 9ec0fd59d..a9c012409 100644 --- a/src/export/Export.cpp +++ b/src/export/Export.cpp @@ -883,21 +883,21 @@ bool Exporter::CheckMix() if (exportedChannels == 1) { if (ShowWarningDialog(pWindow, wxT("MixMono"), - _("Your tracks will be mixed down and exported as one mono file."), + XO("Your tracks will be mixed down and exported as one mono file."), true) == wxID_CANCEL) return false; } else if (exportedChannels == 2) { if (ShowWarningDialog(pWindow, wxT("MixStereo"), - _("Your tracks will be mixed down and exported as one stereo file."), + XO("Your tracks will be mixed down and exported as one stereo file."), true) == wxID_CANCEL) return false; } else { if (ShowWarningDialog(pWindow, wxT("MixUnknownChannels"), - _("Your tracks will be mixed down to one exported file according to the encoder settings."), + XO("Your tracks will be mixed down to one exported file according to the encoder settings."), true) == wxID_CANCEL) return false; } diff --git a/src/export/ExportMultiple.cpp b/src/export/ExportMultiple.cpp index 25257d401..6c1bd34e5 100644 --- a/src/export/ExportMultiple.cpp +++ b/src/export/ExportMultiple.cpp @@ -606,16 +606,16 @@ void ExportMultipleDialog::OnExport(wxCommandEvent& WXUNUSED(event)) // Give 'em the result auto cleanup = finally( [&] { - wxString msg; - msg.Printf( - ok == ProgressResult::Success ? _("Successfully exported the following %lld file(s).") - : (ok == ProgressResult::Failed ? _("Something went wrong after exporting the following %lld file(s).") - : (ok == ProgressResult::Cancelled ? _("Export canceled after exporting the following %lld file(s).") - : (ok == ProgressResult::Stopped ? _("Export stopped after exporting the following %lld file(s).") - : _("Something went really wrong after exporting the following %lld file(s).") - ) - ) - ), (long long) mExported.size()); + auto msg = (ok == ProgressResult::Success + ? XO("Successfully exported the following %lld file(s).") + : ok == ProgressResult::Failed + ? XO("Something went wrong after exporting the following %lld file(s).") + : ok == ProgressResult::Cancelled + ? XO("Export canceled after exporting the following %lld file(s).") + : ok == ProgressResult::Stopped + ? XO("Export stopped after exporting the following %lld file(s).") + : XO("Something went really wrong after exporting the following %lld file(s).") + ).Format((long long) mExported.size()); wxString FileList; for (size_t i = 0; i < mExported.size(); i++) { diff --git a/src/export/ExportPCM.cpp b/src/export/ExportPCM.cpp index 2fdb5d7ac..19c9f6d69 100644 --- a/src/export/ExportPCM.cpp +++ b/src/export/ExportPCM.cpp @@ -401,8 +401,8 @@ ExportPCM::ExportPCM() void ExportPCM::ReportTooBigError(wxWindow * pParent) { //Temporary translation hack, to say 'WAV or AIFF' rather than 'WAV' - wxString message = - _("You have attempted to Export a WAV or AIFF file which would be greater than 4GB.\n" + auto message = + XO("You have attempted to Export a WAV or AIFF file which would be greater than 4GB.\n" "Audacity cannot do this, the Export was abandoned."); ShowErrorDialog(pParent, XO("Error Exporting"), message, @@ -412,7 +412,7 @@ void ExportPCM::ReportTooBigError(wxWindow * pParent) // compute the size in advance. #if 0 ShowErrorDialog(pParent, XO("Error Exporting"), - _("Your exported WAV file has been truncated as Audacity cannot export WAV\n" + XO("Your exported WAV file has been truncated as Audacity cannot export WAV\n" "files bigger than 4GB."), wxT("Size_limits_for_WAV_files")); #endif diff --git a/src/menus/TransportMenus.cpp b/src/menus/TransportMenus.cpp index a54e9373a..ce045e036 100644 --- a/src/menus/TransportMenus.cpp +++ b/src/menus/TransportMenus.cpp @@ -364,11 +364,10 @@ void OnPunchAndRoll(const CommandContext &context) std::max(0L, gPrefs->Read(wxT("/AudioIO/RecordChannels"), 2)); auto message = (recordingChannels == 1) - ? _("Please select in a mono track.") + ? XO("Please select in a mono track.") : (recordingChannels == 2) - ? _("Please select in a stereo track.") - : wxString::Format( - _("Please select at least %d channels."), recordingChannels); + ? XO("Please select in a stereo track.") + : XO("Please select at least %d channels.").Format( recordingChannels ); ShowErrorDialog(&window, XO("Error"), message, url); return; } @@ -410,7 +409,7 @@ void OnPunchAndRoll(const CommandContext &context) } if (error) { - auto message = _("Please select a time within a clip."); + auto message = XO("Please select a time within a clip."); ShowErrorDialog( &window, XO("Error"), message, url); return; } diff --git a/src/widgets/ErrorDialog.cpp b/src/widgets/ErrorDialog.cpp index 403b6054d..874fabad1 100644 --- a/src/widgets/ErrorDialog.cpp +++ b/src/widgets/ErrorDialog.cpp @@ -43,7 +43,7 @@ END_EVENT_TABLE() ErrorDialog::ErrorDialog( wxWindow *parent, const TranslatableString & dlogTitle, - const wxString & message, + const TranslatableString & message, const wxString & helpPage, const bool Close, const bool modal): wxDialogWrapper(parent, (wxWindowID)-1, dlogTitle) @@ -63,7 +63,7 @@ ErrorDialog::ErrorDialog( S.StartVerticalLay(); { S.SetBorder( 20 ); - S.AddFixedText( message ); + S.AddFixedText( message.Translation() ); S.SetBorder( 2 ); S.AddStandardButtons( buttonMask ); } @@ -104,7 +104,7 @@ void ErrorDialog::OnHelp(wxCommandEvent & WXUNUSED(event)) void ShowErrorDialog(wxWindow *parent, const TranslatableString &dlogTitle, - const wxString &message, + const TranslatableString &message, const wxString &helpPage, const bool Close) { @@ -117,7 +117,7 @@ void ShowErrorDialog(wxWindow *parent, // unused. void ShowModelessErrorDialog(wxWindow *parent, const TranslatableString &dlogTitle, - const wxString &message, + const TranslatableString &message, const wxString &helpPage, const bool Close) { diff --git a/src/widgets/ErrorDialog.h b/src/widgets/ErrorDialog.h index 4da36de2d..6b57cc672 100644 --- a/src/widgets/ErrorDialog.h +++ b/src/widgets/ErrorDialog.h @@ -28,7 +28,7 @@ public: // constructors and destructors ErrorDialog(wxWindow *parent, const TranslatableString & dlogTitle, - const wxString & message, + const TranslatableString & message, const wxString & helpPage, const bool Close = true, const bool modal = true); @@ -47,14 +47,14 @@ private: /// Displays an error dialog with a button that offers help void ShowErrorDialog(wxWindow *parent, const TranslatableString &dlogTitle, - const wxString &message, + const TranslatableString &message, const wxString &helpPage, bool Close = true); /// Displays a modeless error dialog with a button that offers help void ShowModelessErrorDialog(wxWindow *parent, const TranslatableString &dlogTitle, - const wxString &message, + const TranslatableString &message, const wxString &helpPage, bool Close = true); diff --git a/src/widgets/HelpSystem.cpp b/src/widgets/HelpSystem.cpp index 29b058959..f7d17cf37 100644 --- a/src/widgets/HelpSystem.cpp +++ b/src/widgets/HelpSystem.cpp @@ -91,7 +91,7 @@ public: /// handled by having the code in one place. void HelpSystem::ShowInfoDialog( wxWindow *parent, const TranslatableString &dlogTitle, - const wxString &shortMsg, + const TranslatableString &shortMsg, const wxString &message, const int xSize, const int ySize) { @@ -105,7 +105,7 @@ void HelpSystem::ShowInfoDialog( wxWindow *parent, S.StartVerticalLay(1); { - S.AddTitle( shortMsg); + S.AddTitle( shortMsg.Translation() ); S.Style( wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_RICH2 | wxTE_AUTO_URL | wxTE_NOHIDESEL | wxHSCROLL ) .AddTextWindow(message); diff --git a/src/widgets/HelpSystem.h b/src/widgets/HelpSystem.h index c86a7f83f..841e0663e 100644 --- a/src/widgets/HelpSystem.h +++ b/src/widgets/HelpSystem.h @@ -38,10 +38,10 @@ class AudacityProject; class HelpSystem { public: - /// Displays cutable information in a text ctrl, with an OK button. + /// Displays cuttable information in a text ctrl, with an OK button. static void ShowInfoDialog( wxWindow *parent, const TranslatableString &dlogTitle, - const wxString &shortMsg, + const TranslatableString &shortMsg, const wxString &message, const int xSize, const int ySize); diff --git a/src/widgets/Warning.cpp b/src/widgets/Warning.cpp index a5d019b8e..89d436bc8 100644 --- a/src/widgets/Warning.cpp +++ b/src/widgets/Warning.cpp @@ -35,8 +35,8 @@ class WarningDialog final : public wxDialogWrapper public: // constructors and destructors WarningDialog(wxWindow *parent, - const wxString &message, - const wxString &footer, + const TranslatableString &message, + const TranslatableString &footer, bool showCancelButton); private: @@ -51,13 +51,14 @@ BEGIN_EVENT_TABLE(WarningDialog, wxDialogWrapper) EVT_BUTTON(wxID_OK, WarningDialog::OnOK) END_EVENT_TABLE() -const wxString &DefaultWarningFooter() +const TranslatableString &DefaultWarningFooter() { - return _("Don't show this warning again"); + static auto result = XO("Don't show this warning again"); + return result; } -WarningDialog::WarningDialog(wxWindow *parent, const wxString &message, - const wxString &footer, +WarningDialog::WarningDialog(wxWindow *parent, const TranslatableString &message, + const TranslatableString &footer, bool showCancelButton) : wxDialogWrapper(parent, wxID_ANY, XO("Warning"), wxDefaultPosition, wxDefaultSize, @@ -71,8 +72,8 @@ WarningDialog::WarningDialog(wxWindow *parent, const wxString &message, S.SetBorder(10); S.StartVerticalLay(false); { - S.AddFixedText(message); - mCheckBox = S.AddCheckBox(footer, false); + S.AddFixedText(message.Translation()); + mCheckBox = S.AddCheckBox(footer.Translation(), false); } S.EndVerticalLay(); @@ -90,9 +91,9 @@ void WarningDialog::OnOK(wxCommandEvent& WXUNUSED(event)) int ShowWarningDialog(wxWindow *parent, const wxString &internalDialogName, - const wxString &message, + const TranslatableString &message, bool showCancelButton, - const wxString &footer) + const TranslatableString &footer) { auto key = WarningDialogKey(internalDialogName); if (!gPrefs->Read(key, (long) true)) { diff --git a/src/widgets/Warning.h b/src/widgets/Warning.h index 2a3730938..5445e54ad 100644 --- a/src/widgets/Warning.h +++ b/src/widgets/Warning.h @@ -15,9 +15,10 @@ #include class wxString; +class TranslatableString; // "Don't show this warning again" - const wxString &DefaultWarningFooter(); + const TranslatableString &DefaultWarningFooter(); /// Displays a warning dialog with a check box. If the user checks /// the box, the internalDialogName is noted in the @@ -25,9 +26,9 @@ class wxString; /// the user; it should be unique to each message. int ShowWarningDialog(wxWindow *parent, const wxString &internalDialogName, - const wxString &message, + const TranslatableString &message, bool showCancelButton = false, // This message appears by the checkbox: - const wxString &footer = DefaultWarningFooter()); + const TranslatableString &footer = DefaultWarningFooter()); #endif // __AUDACITY_WARNING__