mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-01 08:09:41 +02:00
Pass TranslatableString to help, warning, and error dialogs
This commit is contained in:
parent
5909f67fdb
commit
2007346551
@ -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 ) )
|
||||
|
@ -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;
|
||||
|
@ -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."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -737,6 +737,6 @@ void MenuManager::TellUserWhyDisallowed(
|
||||
ShowErrorDialog(
|
||||
NULL,
|
||||
untranslatedTitle,
|
||||
reason.Translation(),
|
||||
reason,
|
||||
helpPage);
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ class AliasBlockFile;
|
||||
class AudacityProject;
|
||||
class TranslatableString;
|
||||
class wxDialog;
|
||||
class TranslatableString;
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
@ -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);
|
||||
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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++) {
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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)) {
|
||||
|
@ -15,9 +15,10 @@
|
||||
|
||||
#include <wx/defs.h>
|
||||
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__
|
||||
|
Loading…
x
Reference in New Issue
Block a user