mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-05 14:18:53 +02:00
AudacityMessageDialog takes TranslatableString message and caption
This commit is contained in:
parent
1b726f4f09
commit
71e9e38083
@ -1017,11 +1017,12 @@ void MacrosWindow::OnRemove(wxCommandEvent & WXUNUSED(event))
|
||||
}
|
||||
|
||||
wxString name = mMacros->GetItemText(item);
|
||||
AudacityMessageDialog m(this,
|
||||
/*i18n-hint: %s will be replaced by the name of a file.*/
|
||||
wxString::Format(_("Are you sure you want to delete %s?"), name),
|
||||
GetTitle(),
|
||||
wxYES_NO | wxICON_QUESTION);
|
||||
AudacityMessageDialog m(
|
||||
this,
|
||||
/*i18n-hint: %s will be replaced by the name of a file.*/
|
||||
XO("Are you sure you want to delete %s?").Format( name ),
|
||||
Verbatim( GetTitle() ),
|
||||
wxYES_NO | wxICON_QUESTION );
|
||||
if (m.ShowModal() == wxID_NO) {
|
||||
Raise();
|
||||
return;
|
||||
|
@ -729,10 +729,10 @@ bool ProjectFileManager::SaveAs(const wxString & newFileName, bool bWantSaveCopy
|
||||
//simply chose to use the save as command although the save command would have the effect.
|
||||
if( !bOwnsNewAupName && wxFileExists(newFileName)) {
|
||||
AudacityMessageDialog m(
|
||||
NULL,
|
||||
_("The project was not saved because the file name provided would overwrite another project.\nPlease try again and select an original name."),
|
||||
_("Error Saving Project"),
|
||||
wxOK|wxICON_ERROR);
|
||||
nullptr,
|
||||
XO("The project was not saved because the file name provided would overwrite another project.\nPlease try again and select an original name."),
|
||||
XO("Error Saving Project"),
|
||||
wxOK|wxICON_ERROR );
|
||||
m.ShowModal();
|
||||
return false;
|
||||
}
|
||||
@ -854,10 +854,10 @@ For an audio file that will open in other apps, use 'Export'.\n");
|
||||
if ((bWantSaveCopy||!bPrompt) && filename.FileExists()) {
|
||||
// Saving a copy of the project should never overwrite an existing project.
|
||||
AudacityMessageDialog m(
|
||||
NULL,
|
||||
_("Saving a copy must not overwrite an existing saved project.\nPlease try again and select an original name."),
|
||||
_("Error Saving Copy of Project"),
|
||||
wxOK|wxICON_ERROR);
|
||||
nullptr,
|
||||
XO("Saving a copy must not overwrite an existing saved project.\nPlease try again and select an original name."),
|
||||
XO("Error Saving Copy of Project"),
|
||||
wxOK|wxICON_ERROR );
|
||||
m.ShowModal();
|
||||
return false;
|
||||
}
|
||||
@ -905,10 +905,10 @@ will be irreversibly overwritten."), fName, fName);
|
||||
{
|
||||
// Overwrite disalowed. The destination project is open in another window.
|
||||
AudacityMessageDialog m(
|
||||
NULL,
|
||||
_("The project will not be saved because the selected project is open in another window.\nPlease try again and select an original name."),
|
||||
_("Error Saving Project"),
|
||||
wxOK|wxICON_ERROR);
|
||||
nullptr,
|
||||
XO("The project will not saved because the selected project is open in another window.\nPlease try again and select an original name."),
|
||||
XO("Error Saving Project"),
|
||||
wxOK|wxICON_ERROR );
|
||||
m.ShowModal();
|
||||
return false;
|
||||
}
|
||||
|
@ -335,11 +335,11 @@ void TimerRecordDialog::OnAutoSavePathButton_Click(wxCommandEvent& WXUNUSED(even
|
||||
// unless it is the current project.
|
||||
if (wxFileExists(fName) && (pProject->GetFileName() != fName)) {
|
||||
AudacityMessageDialog m(
|
||||
NULL,
|
||||
_("The selected file name could not be used\nfor Timer Recording because it \
|
||||
nullptr,
|
||||
XO("The selected file name could not be used\nfor Timer Recording because it \
|
||||
would overwrite another project.\nPlease try again and select an original name."),
|
||||
_("Error Saving Timer Recording Project"),
|
||||
wxOK|wxICON_ERROR);
|
||||
XO("Error Saving Timer Recording Project"),
|
||||
wxOK|wxICON_ERROR );
|
||||
m.ShowModal();
|
||||
return;
|
||||
}
|
||||
@ -437,16 +437,16 @@ void TimerRecordDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
||||
sPlannedTime = projectManager.GetHoursMinsString(iMinsRecording);
|
||||
|
||||
// Create the message string
|
||||
wxString sMessage;
|
||||
sMessage.Printf(_("You may not have enough free disk space to complete this Timer Recording, based on your current settings.\n\nDo you wish to continue?\n\nPlanned recording duration: %s\nRecording time remaining on disk: %s"),
|
||||
sPlannedTime,
|
||||
sRemainingTime);
|
||||
auto sMessage = XO(
|
||||
"You may not have enough free disk space to complete this Timer Recording, based on your current settings.\n\nDo you wish to continue?\n\nPlanned recording duration: %s\nRecording time remaining on disk: %s")
|
||||
.Format( sPlannedTime, sRemainingTime );
|
||||
|
||||
AudacityMessageDialog dlgMessage(NULL,
|
||||
AudacityMessageDialog dlgMessage(
|
||||
nullptr,
|
||||
sMessage,
|
||||
_("Timer Recording Disk Space Warning"),
|
||||
XO("Timer Recording Disk Space Warning"),
|
||||
wxYES_NO | wxNO_DEFAULT | wxICON_WARNING);
|
||||
if (dlgMessage.ShowModal() != wxID_YES) {
|
||||
if (dlgMessage.ShowModal() != wxID_YES ) {
|
||||
// User decided not to continue - bail out!
|
||||
return;
|
||||
}
|
||||
|
@ -819,16 +819,25 @@ void VoiceKey::CalibrateNoise(const WaveTrack & t, sampleCount start, sampleCoun
|
||||
mDirectionChangesMean = sumdc / samples;
|
||||
mDirectionChangesSD =sqrt(sumdc2 / samples - mDirectionChangesMean * mDirectionChangesMean) ;
|
||||
|
||||
wxString text = _("Calibration Results\n");
|
||||
auto text = XO("Calibration Results\n");
|
||||
/* i18n-hint: %1.4f is replaced by a number. sd stands for 'Standard Deviations'*/
|
||||
text += wxString::Format(_("Energy -- mean: %1.4f sd: (%1.4f)\n"),mEnergyMean,mEnergySD);
|
||||
text+= wxString::Format(_("Sign Changes -- mean: %1.4f sd: (%1.4f)\n"),mSignChangesMean,mSignChangesSD);
|
||||
text += wxString::Format(_("Direction Changes -- mean: %1.4f sd: (%1.4f)\n"), mDirectionChangesMean, mDirectionChangesSD);
|
||||
AudacityMessageDialog{ NULL, text,
|
||||
_("Calibration Complete"),
|
||||
text +=
|
||||
XO("Energy -- mean: %1.4f sd: (%1.4f)\n")
|
||||
.Format( mEnergyMean, mEnergySD );
|
||||
text +=
|
||||
XO("Sign Changes -- mean: %1.4f sd: (%1.4f)\n")
|
||||
.Format( mSignChangesMean, mSignChangesSD );
|
||||
text +=
|
||||
XO("Direction Changes -- mean: %1.4f sd: (%1.4f)\n")
|
||||
.Format( mDirectionChangesMean, mDirectionChangesSD );
|
||||
AudacityMessageDialog{
|
||||
nullptr,
|
||||
text,
|
||||
XO("Calibration Complete"),
|
||||
wxOK | wxICON_INFORMATION,
|
||||
wxPoint(-1, -1) }
|
||||
.ShowModal();
|
||||
wxPoint(-1, -1)
|
||||
}
|
||||
.ShowModal();
|
||||
|
||||
AdjustThreshold(mThresholdAdjustment);
|
||||
}
|
||||
|
@ -55,12 +55,20 @@ bool ContrastDialog::GetDB(float &dB)
|
||||
TrackList::Get( *p ).SelectedLeaders< const WaveTrack >();
|
||||
auto numberSelectedTracks = range.size();
|
||||
if (numberSelectedTracks > 1) {
|
||||
AudacityMessageDialog m(NULL, _("You can only measure one track at a time."), _("Error"), wxOK);
|
||||
AudacityMessageDialog m(
|
||||
nullptr,
|
||||
XO("You can only measure one track at a time."),
|
||||
XO("Error"),
|
||||
wxOK);
|
||||
m.ShowModal();
|
||||
return false;
|
||||
}
|
||||
if(numberSelectedTracks == 0) {
|
||||
AudacityMessageDialog m(NULL, _("Please select an audio track."), _("Error"), wxOK);
|
||||
AudacityMessageDialog m(
|
||||
nullptr,
|
||||
XO("Please select an audio track."),
|
||||
XO("Error"),
|
||||
wxOK);
|
||||
m.ShowModal();
|
||||
return false;
|
||||
}
|
||||
@ -80,14 +88,22 @@ bool ContrastDialog::GetDB(float &dB)
|
||||
|
||||
if(SelT0 > SelT1)
|
||||
{
|
||||
AudacityMessageDialog m(NULL, _("Invalid audio selection.\nPlease ensure that audio is selected."), _("Error"), wxOK);
|
||||
AudacityMessageDialog m(
|
||||
nullptr,
|
||||
XO("Invalid audio selection.\nPlease ensure that audio is selected."),
|
||||
XO("Error"),
|
||||
wxOK);
|
||||
m.ShowModal();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(SelT0 == SelT1)
|
||||
{
|
||||
AudacityMessageDialog m(NULL, _("Nothing to measure.\nPlease select a section of a track."), _("Error"), wxOK);
|
||||
AudacityMessageDialog m(
|
||||
nullptr,
|
||||
XO("Nothing to measure.\nPlease select a section of a track."),
|
||||
XO("Error"),
|
||||
wxOK);
|
||||
m.ShowModal();
|
||||
return false;
|
||||
}
|
||||
|
@ -3503,9 +3503,10 @@ void EffectUIHost::OnSaveAs(wxCommandEvent & WXUNUSED(evt))
|
||||
name = text->GetValue();
|
||||
if (name.empty())
|
||||
{
|
||||
AudacityMessageDialog md(this,
|
||||
_("You must specify a name"),
|
||||
_("Save Preset"));
|
||||
AudacityMessageDialog md(
|
||||
this,
|
||||
XO("You must specify a name"),
|
||||
XO("Save Preset") );
|
||||
md.Center();
|
||||
md.ShowModal();
|
||||
continue;
|
||||
@ -3513,10 +3514,11 @@ void EffectUIHost::OnSaveAs(wxCommandEvent & WXUNUSED(evt))
|
||||
|
||||
if ( make_iterator_range( mUserPresets ).contains( name ) )
|
||||
{
|
||||
AudacityMessageDialog md(this,
|
||||
_("Preset already exists.\n\nReplace?"),
|
||||
_("Save Preset"),
|
||||
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION);
|
||||
AudacityMessageDialog md(
|
||||
this,
|
||||
XO("Preset already exists.\n\nReplace?"),
|
||||
XO("Save Preset"),
|
||||
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION );
|
||||
md.Center();
|
||||
int choice = md.ShowModal();
|
||||
if (choice == wxID_CANCEL)
|
||||
|
@ -1558,7 +1558,9 @@ bool ProgressDialog::SearchForWindow(const wxWindowList & list, const wxWindow *
|
||||
|
||||
void ProgressDialog::OnCancel(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
if (!ConfirmAction(_("Are you sure you wish to cancel?"), _("Confirm Cancel"), wxID_CANCEL)) {
|
||||
if (!ConfirmAction(
|
||||
XO("Are you sure you wish to cancel?"),
|
||||
XO("Confirm Cancel"), wxID_CANCEL)) {
|
||||
return;
|
||||
}
|
||||
FindWindowById(wxID_CANCEL, this)->Disable();
|
||||
@ -1567,7 +1569,9 @@ void ProgressDialog::OnCancel(wxCommandEvent & WXUNUSED(event))
|
||||
|
||||
void ProgressDialog::OnStop(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
if (!ConfirmAction(_("Are you sure you wish to stop?"), _("Confirm Stop"), wxID_OK)) {
|
||||
if (!ConfirmAction(
|
||||
XO("Are you sure you wish to stop?"),
|
||||
XO("Confirm Stop"), wxID_OK)) {
|
||||
return;
|
||||
}
|
||||
FindWindowById(wxID_OK, this)->Disable();
|
||||
@ -1577,7 +1581,8 @@ void ProgressDialog::OnStop(wxCommandEvent & WXUNUSED(event))
|
||||
|
||||
void ProgressDialog::OnCloseWindow(wxCloseEvent & WXUNUSED(event))
|
||||
{
|
||||
if (!ConfirmAction(_("Are you sure you wish to close?"), _("Confirm Close"))) {
|
||||
if (!ConfirmAction(
|
||||
XO("Are you sure you wish to close?"), XO("Confirm Close"))) {
|
||||
return;
|
||||
}
|
||||
mCancel = true;
|
||||
@ -1616,8 +1621,8 @@ void ProgressDialog::Beep() const
|
||||
|
||||
// Confirm action taken by user.
|
||||
// Returns TRUE if the user confirms Yes
|
||||
bool ProgressDialog::ConfirmAction(const wxString & sPrompt,
|
||||
const wxString & sTitle,
|
||||
bool ProgressDialog::ConfirmAction(const TranslatableString & sPrompt,
|
||||
const TranslatableString & sTitle,
|
||||
int iButtonID /* = -1 */) {
|
||||
|
||||
// Check if confirmations are enabled?
|
||||
@ -1626,10 +1631,11 @@ bool ProgressDialog::ConfirmAction(const wxString & sPrompt,
|
||||
return true;
|
||||
}
|
||||
|
||||
AudacityMessageDialog dlgMessage(this,
|
||||
AudacityMessageDialog dlgMessage(
|
||||
this,
|
||||
sPrompt,
|
||||
sTitle,
|
||||
wxYES_NO | wxICON_QUESTION | wxNO_DEFAULT | wxSTAY_ON_TOP);
|
||||
wxYES_NO | wxICON_QUESTION | wxNO_DEFAULT | wxSTAY_ON_TOP );
|
||||
int iAction = dlgMessage.ShowModal();
|
||||
|
||||
bool bReturn = (iAction == wxID_YES);
|
||||
|
@ -133,8 +133,8 @@ private:
|
||||
void OnCloseWindow(wxCloseEvent & e);
|
||||
void Beep() const;
|
||||
|
||||
bool ConfirmAction(const wxString & sPrompt,
|
||||
const wxString & sTitle,
|
||||
bool ConfirmAction(const TranslatableString & sPrompt,
|
||||
const TranslatableString & sTitle,
|
||||
int iButtonID = -1);
|
||||
|
||||
void AddMessageAsColumn(wxBoxSizer * pSizer,
|
||||
|
@ -213,12 +213,12 @@ class AudacityMessageDialog : public wxTabTraversalWrapper< wxMessageDialog >
|
||||
public:
|
||||
AudacityMessageDialog(
|
||||
wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption, // don't use = wxMessageBoxCaptionStr,
|
||||
const TranslatableString &message,
|
||||
const TranslatableString &caption, // don't use = wxMessageBoxCaptionStr,
|
||||
long style = wxOK|wxCENTRE,
|
||||
const wxPoint& pos = wxDefaultPosition)
|
||||
: wxTabTraversalWrapper< wxMessageDialog>
|
||||
( parent, message, caption, style, pos )
|
||||
( parent, message.Translation(), caption.Translation(), style, pos )
|
||||
{}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user