AudacityMessageBox takes TranslatableString message and caption

This commit is contained in:
Paul Licameli 2019-12-07 14:30:07 -05:00
parent d8c2610d88
commit dc39f22442
77 changed files with 1005 additions and 748 deletions

View File

@ -1091,8 +1091,8 @@ void NyqBench::OnSave(wxCommandEvent & e)
if (!mScript->SaveFile(mPath.GetFullPath()))
{
AudacityMessageBox(_("Script was not saved."),
_("Warning"),
AudacityMessageBox(XO("Script was not saved."),
XO("Warning"),
wxICON_EXCLAMATION,
this);
return;
@ -1121,8 +1121,8 @@ void NyqBench::OnSaveAs(wxCommandEvent & e)
if (!mScript->SaveFile(mPath.GetFullPath()))
{
AudacityMessageBox(_("Script was not saved."),
_("Warning"),
AudacityMessageBox(XO("Script was not saved."),
XO("Warning"),
wxICON_EXCLAMATION,
this);
return;
@ -1496,8 +1496,8 @@ void NyqBench::OnFindDialog(wxFindDialogEvent & e)
}
if (pos == wxString::npos) {
AudacityMessageBox(_("No matches found"),
_("Nyquist Effect Workbench"),
AudacityMessageBox(XO("No matches found"),
XO("Nyquist Effect Workbench"),
wxOK | wxCENTER,
e.GetDialog());
@ -1634,8 +1634,8 @@ bool NyqBench::Validate()
{
if (mScript->GetLastPosition() > 0 && mScript->IsModified()) {
int ans;
ans = AudacityMessageBox(_("Code has been modified. Are you sure?"),
_("Warning"),
ans = AudacityMessageBox(XO("Code has been modified. Are you sure?"),
XO("Warning"),
wxYES_NO | wxICON_QUESTION,
this);
if (ans == wxNO) {

View File

@ -2336,8 +2336,9 @@ void AdornedRulerPanel::LockPlayRegion()
auto &viewInfo = ViewInfo::Get( project );
auto &playRegion = viewInfo.playRegion;
if (playRegion.GetStart() >= tracks.GetEndTime()) {
AudacityMessageBox(_("Cannot lock region beyond\nend of project."),
_("Error"));
AudacityMessageBox(
XO("Cannot lock region beyond\nend of project."),
XO("Error"));
}
else {
playRegion.SetLocked( true );

View File

@ -313,7 +313,9 @@ void PopulatePreferences()
bool gone = wxRemoveFile(fullPath); // remove FirstTime.ini
if (!gone)
{
AudacityMessageBox(wxString::Format(_("Failed to remove %s"), fullPath), _("Failed!"));
AudacityMessageBox(
XO("Failed to remove %s").Format(fullPath),
XO("Failed!"));
}
}
@ -323,9 +325,12 @@ void PopulatePreferences()
if (resetPrefs)
{
// pop up a dialogue
wxString prompt = _("Reset Preferences?\n\nThis is a one-time question, after an 'install' where you asked to have the Preferences reset.");
int action = AudacityMessageBox(prompt, _("Reset Audacity Preferences"),
wxYES_NO, NULL);
auto prompt = XO(
"Reset Preferences?\n\nThis is a one-time question, after an 'install' where you asked to have the Preferences reset.");
int action = AudacityMessageBox(
prompt,
XO("Reset Audacity Preferences"),
wxYES_NO, NULL);
if (action == wxYES) // reset
{
gPrefs->DeleteAll();
@ -955,8 +960,10 @@ bool AudacityApp::MRUOpen(const FilePath &fullPathStr) {
}
else {
// File doesn't exist - remove file from history
AudacityMessageBox(wxString::Format(_("%s could not be found.\n\nIt has been removed from the list of recent files."),
fullPathStr));
AudacityMessageBox(
XO(
"%s could not be found.\n\nIt has been removed from the list of recent files.")
.Format(fullPathStr) );
return(false);
}
}
@ -1475,7 +1482,7 @@ bool AudacityApp::OnInit()
}
else
{
wxPrintf( AutoSaveFile::FailureMessage( fileName ) );
wxPrintf( AutoSaveFile::FailureMessage( fileName ) .Translation() ); //Debug()?
}
exit(1);
}
@ -1777,9 +1784,11 @@ bool AudacityApp::InitTempDir()
if (temp.empty()) {
// Failed
if( !FileNames::IsTempDirectoryNameOK( tempFromPrefs ) ) {
AudacityMessageBox(_("Audacity could not find a safe place to store temporary files.\nAudacity needs a place where automatic cleanup programs won't delete the temporary files.\nPlease enter an appropriate directory in the preferences dialog."));
AudacityMessageBox(XO(
"Audacity could not find a safe place to store temporary files.\nAudacity needs a place where automatic cleanup programs won't delete the temporary files.\nPlease enter an appropriate directory in the preferences dialog."));
} else {
AudacityMessageBox(_("Audacity could not find a place to store temporary files.\nPlease enter an appropriate directory in the preferences dialog."));
AudacityMessageBox(XO(
"Audacity could not find a place to store temporary files.\nPlease enter an appropriate directory in the preferences dialog."));
}
// Only want one page of the preferences
@ -1788,7 +1797,8 @@ bool AudacityApp::InitTempDir()
GlobalPrefsDialog dialog(NULL, factories);
dialog.ShowModal();
AudacityMessageBox(_("Audacity is now going to exit. Please launch Audacity again to use the new temporary directory."));
AudacityMessageBox(XO(
"Audacity is now going to exit. Please launch Audacity again to use the new temporary directory."));
return false;
}
@ -1823,20 +1833,20 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
wxString sockFile(dir + wxT("/.audacity.sock"));
#endif
wxString runningTwoCopiesStr = _("Running two copies of Audacity simultaneously may cause\ndata loss or cause your system to crash.\n\n");
auto runningTwoCopiesStr = XO("Running two copies of Audacity simultaneously may cause\ndata loss or cause your system to crash.\n\n");
if (!checker->Create(name, dir)) {
// Error initializing the wxSingleInstanceChecker. We don't know
// whether there is another instance running or not.
wxString prompt =
_("Audacity was not able to lock the temporary files directory.\nThis folder may be in use by another copy of Audacity.\n") +
runningTwoCopiesStr +
_("Do you still want to start Audacity?");
int action = AudacityMessageBox(prompt,
_("Error Locking Temporary Folder"),
wxYES_NO | wxICON_EXCLAMATION,
NULL);
auto prompt = XO(
"Audacity was not able to lock the temporary files directory.\nThis folder may be in use by another copy of Audacity.\n")
+ runningTwoCopiesStr
+ XO("Do you still want to start Audacity?");
int action = AudacityMessageBox(
prompt,
XO("Error Locking Temporary Folder"),
wxYES_NO | wxICON_EXCLAMATION, NULL);
if (action == wxNO)
return false;
}
@ -1945,12 +1955,14 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
#endif
// There is another copy of Audacity running. Force quit.
wxString prompt =
_("The system has detected that another copy of Audacity is running.\n") +
runningTwoCopiesStr +
_("Use the New or Open commands in the currently running Audacity\nprocess to open multiple projects simultaneously.\n");
AudacityMessageBox(prompt, _("Audacity is already running"),
wxOK | wxICON_ERROR);
auto prompt = XO(
"The system has detected that another copy of Audacity is running.\n")
+ runningTwoCopiesStr
+ XO(
"Use the New or Open commands in the currently running Audacity\nprocess to open multiple projects simultaneously.\n");
AudacityMessageBox(
prompt, XO("Audacity is already running"),
wxOK | wxICON_ERROR);
#ifdef __WXMAC__
// Bug 2052
@ -1958,10 +1970,10 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
auto lockFileName = wxFileName(dir,name);
bool bIsLocked = lockFileName.IsOk() && lockFileName.FileExists();
if( bIsLocked ){
int action = AudacityMessageBox(wxString::Format( _("If you're sure another copy of Audacity isn't\nrunning, Audacity can skip the test for\n'Audacity already running' next time\nby removing the lock file:\n\n%s\n\nDo you want to do that?"),
lockFileName.GetFullName()
),
_("Possible Lock File Problem"),
int action = AudacityMessageBox(
XO("If you're sure another copy of Audacity isn't\nrunning, Audacity can skip the test for\n'Audacity already running' next time\nby removing the lock file:\n\n%s\n\nDo you want to do that?")
.Format(lockFileName.GetFullName()),
XO("Possible Lock File Problem"),
wxYES_NO | wxICON_EXCLAMATION,
NULL);
if (action == wxYES){
@ -2289,8 +2301,9 @@ void AudacityApp::AssociateFileTypes()
// and they got stepped on, so ask.
int wantAssoc =
AudacityMessageBox(
_("Audacity project (.AUP) files are not currently \nassociated with Audacity. \n\nAssociate them, so they open on double-click?"),
_("Audacity Project Files"),
XO(
"Audacity project (.AUP) files are not currently \nassociated with Audacity. \n\nAssociate them, so they open on double-click?"),
XO("Audacity Project Files"),
wxYES_NO | wxICON_QUESTION);
if (wantAssoc == wxYES) {
gPrefs->Write(wxT("/WantAssociateFiles"), true);

View File

@ -96,8 +96,8 @@ void MessageBoxException::DelayedHandlerAction()
// give the user no useful added information.
if ( wxAtomicDec( sOutstandingMessages ) == 0 )
::AudacityMessageBox(
ErrorMessage().Translation(),
(caption.empty() ? AudacityMessageBoxCaptionStr() : caption).Translation(),
ErrorMessage(),
(caption.empty() ? AudacityMessageBoxCaptionStr() : caption),
wxICON_ERROR
);
moved = true;

View File

@ -265,8 +265,8 @@ void AudacityLogger::OnSave(wxCommandEvent & WXUNUSED(e))
if (!mText->SaveFile(fName)) {
AudacityMessageBox(
wxString::Format( _("Couldn't save log to file: %s"), fName ),
_("Warning"),
XO("Couldn't save log to file: %s").Format( fName ),
XO("Warning"),
wxICON_EXCLAMATION,
mFrame.get());
return;

View File

@ -986,14 +986,17 @@ AudioIO::AudioIO()
PaError err = Pa_Initialize();
if (err != paNoError) {
wxString errStr = _("Could not find any audio devices.\n");
errStr += _("You will not be able to play or record audio.\n\n");
auto errStr = XO("Could not find any audio devices.\n");
errStr += XO("You will not be able to play or record audio.\n\n");
wxString paErrStr = LAT1CTOWX(Pa_GetErrorText(err));
if (!paErrStr.empty())
errStr += _("Error: ")+paErrStr;
errStr += XO("Error: %s").Format( paErrStr );
// XXX: we are in libaudacity, popping up dialogs not allowed! A
// long-term solution will probably involve exceptions
AudacityMessageBox(errStr, _("Error Initializing Audio"), wxICON_ERROR|wxOK);
AudacityMessageBox(
errStr,
XO("Error Initializing Audio"),
wxICON_ERROR|wxOK);
// Since PortAudio is not initialized, all calls to PortAudio
// functions will fail. This will give reasonable behavior, since
@ -1005,15 +1008,18 @@ AudioIO::AudioIO()
PmError pmErr = Pm_Initialize();
if (pmErr != pmNoError) {
wxString errStr =
_("There was an error initializing the midi i/o layer.\n");
errStr += _("You will not be able to play midi.\n\n");
auto errStr =
XO("There was an error initializing the midi i/o layer.\n");
errStr += XO("You will not be able to play midi.\n\n");
wxString pmErrStr = LAT1CTOWX(Pm_GetErrorText(pmErr));
if (!pmErrStr.empty())
errStr += _("Error: ") + pmErrStr;
errStr += XO("Error: %s").Format( pmErrStr );
// XXX: we are in libaudacity, popping up dialogs not allowed! A
// long-term solution will probably involve exceptions
AudacityMessageBox(errStr, _("Error Initializing Midi"), wxICON_ERROR|wxOK);
AudacityMessageBox(
errStr,
XO("Error Initializing Midi"),
wxICON_ERROR|wxOK);
// Same logic for PortMidi as described above for PortAudio
}
@ -1759,7 +1765,9 @@ int AudioIO::StartStream(const TransportTracks &tracks,
if (pListener && mNumCaptureChannels > 0)
pListener->OnAudioIOStopRecording();
StartStreamCleanup();
AudacityMessageBox(LAT1CTOWX(Pa_GetErrorText(err)));
// PRL: PortAudio error messages are sadly not internationalized
AudacityMessageBox(
Verbatim( LAT1CTOWX(Pa_GetErrorText(err)) ) );
return 0;
}
}
@ -1934,7 +1942,7 @@ bool AudioIO::AllocateBuffers(
// 100 samples, just give up.
if(captureBufferSize < 100)
{
AudacityMessageBox(_("Out of memory!"));
AudacityMessageBox( XO("Out of memory!") );
return false;
}
@ -1969,7 +1977,7 @@ bool AudioIO::AllocateBuffers(
(size_t)lrint(mRate * mPlaybackRingBufferSecs);
if(playbackBufferSize < 100 || mPlaybackSamplesToCopy < 100)
{
AudacityMessageBox(_("Out of memory!"));
AudacityMessageBox( XO("Out of memory!") );
return false;
}
}

View File

@ -246,10 +246,10 @@ enum FieldTypes
FT_Name // type, ID, name length, name
};
wxString AutoSaveFile::FailureMessage( const FilePath &/*filePath*/ )
TranslatableString AutoSaveFile::FailureMessage( const FilePath &/*filePath*/ )
{
return
_("This recovery file was saved by Audacity 2.3.0 or before.\n"
XO("This recovery file was saved by Audacity 2.3.0 or before.\n"
"You need to run that version of Audacity to recover the project." );
}

View File

@ -59,7 +59,7 @@ class AUDACITY_DLL_API AutoSaveFile final : public XMLWriter
{
public:
static wxString FailureMessage( const FilePath &filePath );
static TranslatableString FailureMessage( const FilePath &filePath );
AutoSaveFile(size_t allocSize = 1024 * 1024);
virtual ~AutoSaveFile();

View File

@ -126,8 +126,10 @@ void AutoRecoveryDialog::OnQuitAudacity(wxCommandEvent & WXUNUSED(event))
void AutoRecoveryDialog::OnRecoverNone(wxCommandEvent & WXUNUSED(event))
{
int ret = AudacityMessageBox(
_("Are you sure you want to discard all recoverable projects?\n\nChoosing \"Yes\" discards all recoverable projects immediately."),
_("Confirm Discard Projects"), wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT, this);
XO(
"Are you sure you want to discard all recoverable projects?\n\nChoosing \"Yes\" discards all recoverable projects immediately."),
XO("Confirm Discard Projects"),
wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT, this);
if (ret == wxYES)
EndModal(ID_RECOVER_NONE);
@ -145,8 +147,10 @@ static bool HaveFilesToRecover()
wxDir dir(FileNames::AutoSaveDir());
if (!dir.IsOpened())
{
AudacityMessageBox(_("Could not enumerate files in auto save directory."),
_("Error"), wxICON_STOP);
AudacityMessageBox(
XO("Could not enumerate files in auto save directory."),
XO("Error"),
wxICON_STOP);
return false;
}
@ -168,8 +172,10 @@ static bool RemoveAllAutoSaveFiles()
{
// I don't think this error message is actually useful.
// -dmazzoni
//AudacityMessageBox(wxT("Could not remove auto save file: " + files[i]),
// _("Error"), wxICON_STOP);
//AudacityMessageBox(
// XO("Could not remove auto save file: %s".Format( files[i] ),
// XO("Error"),
// wxICON_STOP);
return false;
}
}
@ -182,8 +188,10 @@ static bool RecoverAllProjects(AudacityProject** pproj)
wxDir dir(FileNames::AutoSaveDir());
if (!dir.IsOpened())
{
AudacityMessageBox(_("Could not enumerate files in auto save directory."),
_("Error"), wxICON_STOP);
AudacityMessageBox(
XO("Could not enumerate files in auto save directory."),
XO("Error"),
wxICON_STOP);
return false;
}

View File

@ -485,7 +485,7 @@ double MacroCommands::GetEndTime()
AudacityProject *project = GetActiveProject();
if( project == NULL )
{
//AudacityMessageBox( _("No project to process!") );
//AudacityMessageBox( XO("No project to process!") );
return -1.0;
}
auto &tracks = TrackList::Get( *project );
@ -499,7 +499,7 @@ bool MacroCommands::IsMono()
AudacityProject *project = GetActiveProject();
if( project == NULL )
{
//AudacityMessageBox( _("No project and no Audio to process!") );
//AudacityMessageBox( XO("No project and no Audio to process!") );
return false;
}
@ -515,6 +515,7 @@ wxString MacroCommands::BuildCleanFileName(const FilePath &fileName,
wxString justName = newFileName.GetName();
wxString pathName = newFileName.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
// PRL: should this translate?
const wxString cleanedString( "macro-output" );
if (justName.empty()) {
@ -535,9 +536,10 @@ wxString MacroCommands::BuildCleanFileName(const FilePath &fileName,
// double startTime = 0.0;
//OnSelectAll();
pathName = FileNames::FindDefaultPath(FileNames::Operation::Export);
::AudacityMessageBox(wxString::Format(_("Export recording to %s\n/%s/%s%s"),
pathName, cleanedString, justName, extension),
_("Export recording"),
::AudacityMessageBox(
XO("Export recording to %s\n/%s/%s%s")
.Format(pathName, cleanedString, justName, extension),
XO("Export recording"),
wxOK | wxCENTRE);
pathName += wxFileName::GetPathSeparator();
}
@ -545,9 +547,10 @@ wxString MacroCommands::BuildCleanFileName(const FilePath &fileName,
cleanedName += cleanedString;
bool flag = ::wxFileName::FileExists(cleanedName);
if (flag == true) {
::AudacityMessageBox(_("Cannot create directory '%s'. \nFile already exists that is not a directory"),
cleanedName
);
::AudacityMessageBox(
XO(
"Cannot create directory '%s'. \nFile already exists that is not a directory"),
Verbatim( cleanedName ) );
return wxString{};
}
::wxFileName::Mkdir(cleanedName, 0777, wxPATH_MKDIR_FULL); // make sure it exists
@ -685,7 +688,8 @@ bool MacroCommands::ApplySpecialCommand(
}
return mExporter.Process(project, numChannels, wxT("OGG"), filename, false, 0.0, endTime);
#else
AudacityMessageBox(_("Ogg Vorbis support is not included in this build of Audacity"));
AudacityMessageBox( XO(
"Ogg Vorbis support is not included in this build of Audacity"));
return false;
#endif
} else if (command == wxT("ExportFLAC")) {
@ -697,12 +701,13 @@ bool MacroCommands::ApplySpecialCommand(
}
return mExporter.Process(project, numChannels, wxT("FLAC"), filename, false, 0.0, endTime);
#else
AudacityMessageBox(_("FLAC support is not included in this build of Audacity"));
AudacityMessageBox(XO(
"FLAC support is not included in this build of Audacity"));
return false;
#endif
}
AudacityMessageBox(
wxString::Format(_("Command %s not implemented yet"), friendlyCommand));
XO("Command %s not implemented yet").Format( friendlyCommand ) );
return false;
}
// end CLEANSPEECH remnant
@ -879,8 +884,8 @@ bool MacroCommands::ApplyCommand( const wxString &friendlyCommand,
}
AudacityMessageBox(
wxString::Format(
_("Your batch command of %s was not recognized."), friendlyCommand ));
XO("Your batch command of %s was not recognized.")
.Format( friendlyCommand ) );
return false;
}
@ -1030,13 +1035,16 @@ bool MacroCommands::ReportAndSkip(
//TODO: Add a cancel button to these, and add the logic so that we can abort.
if( !params.empty() )
{
AudacityMessageBox( wxString::Format(_("Apply %s with parameter(s)\n\n%s"),friendlyCommand, params),
_("Test Mode"));
AudacityMessageBox(
XO("Apply %s with parameter(s)\n\n%s")
.Format( friendlyCommand, params ),
XO("Test Mode"));
}
else
{
AudacityMessageBox( wxString::Format(_("Apply %s"), friendlyCommand),
_("Test Mode"));
AudacityMessageBox(
XO("Apply %s").Format( friendlyCommand ),
XO("Test Mode"));
}
return true;
}

View File

@ -224,7 +224,7 @@ void ApplyMacroDialog::OnApplyToProject(wxCommandEvent & WXUNUSED(event))
wxLIST_STATE_SELECTED);
if (item == -1) {
AudacityMessageBox(_("No macro selected"));
AudacityMessageBox(XO("No macro selected"));
return;
}
ApplyMacroToProject( item );
@ -322,7 +322,7 @@ void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
wxLIST_NEXT_ALL,
wxLIST_STATE_SELECTED);
if (item == -1) {
AudacityMessageBox(_("No macro selected"));
AudacityMessageBox( XO("No macro selected") );
return;
}
@ -332,7 +332,8 @@ void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
AudacityProject *project = GetActiveProject();
if (!TrackList::Get( *project ).empty()) {
AudacityMessageBox(_("Please save and close the current project first."));
AudacityMessageBox(
XO("Please save and close the current project first.") );
return;
}
@ -558,7 +559,7 @@ MacrosWindow::MacrosWindow(wxWindow * parent, bool bExpanded):
ApplyMacroDialog(parent, true)
{
mbExpanded = bExpanded;
auto Title = mbExpanded ? XO("Manage Macros") : XO("Macros Palette");
auto Title = WindowTitle();
SetLabel( Title ); // Provide visual label
SetName( Title ); // Provide audible label
SetTitle( Title );
@ -794,7 +795,7 @@ void MacrosWindow::UpdateDisplay( bool bExpanded )
SetPosition( p );
mResize->SetFocus();
auto Title = mbExpanded ? XO("Manage Macros") : XO("Macros Palette");
auto Title = WindowTitle();
SetLabel( Title ); // Provide visual label
SetName( Title ); // Provide audible label
SetTitle( Title );
@ -810,14 +811,15 @@ void MacrosWindow::OnShrink(wxCommandEvent &WXUNUSED(event))
bool MacrosWindow::ChangeOK()
{
if (mChanged) {
wxString title;
wxString msg;
int id;
title.Printf(_("%s changed"), mActiveMacro);
msg = _("Do you want to save the changes?");
auto title = XO("%s changed").Format( mActiveMacro );
auto msg = XO("Do you want to save the changes?");
id = AudacityMessageBox(msg, title, wxYES_NO | wxCANCEL);
id = AudacityMessageBox(
msg,
title,
wxYES_NO | wxCANCEL);
if (id == wxCANCEL) {
return false;
}
@ -977,21 +979,23 @@ void MacrosWindow::OnAdd(wxCommandEvent & WXUNUSED(event))
name = d.GetValue().Strip(wxString::both);
if (name.length() == 0) {
AudacityMessageBox(_("Name must not be blank"),
GetTitle(),
wxOK | wxICON_ERROR,
this);
AudacityMessageBox(
XO("Name must not be blank"),
WindowTitle(),
wxOK | wxICON_ERROR,
this);
continue;
}
if (name.Contains(wxFILE_SEP_PATH) ||
name.Contains(wxFILE_SEP_PATH_UNIX)) {
/*i18n-hint: The %c will be replaced with 'forbidden characters', like '/' and '\'.*/
AudacityMessageBox(wxString::Format(_("Names may not contain '%c' and '%c'"),
wxFILE_SEP_PATH, wxFILE_SEP_PATH_UNIX),
GetTitle(),
wxOK | wxICON_ERROR,
this);
AudacityMessageBox(
XO("Names may not contain '%c' and '%c'")
.Format(wxFILE_SEP_PATH, wxFILE_SEP_PATH_UNIX),
WindowTitle(),
wxOK | wxICON_ERROR,
this);
continue;
}
@ -1256,3 +1260,8 @@ void MacrosWindow::OnKeyDown(wxKeyEvent &event)
event.Skip();
}
TranslatableString MacrosWindow::WindowTitle() const
{
return mbExpanded ? XO("Manage Macros") : XO("Macros Palette");
}

View File

@ -74,6 +74,8 @@ public:
void UpdateDisplay( bool bExpanded );
private:
TranslatableString WindowTitle() const;
void Populate();
void PopulateOrExchange(ShuttleGui &S);
void OnApplyToProject(wxCommandEvent & event) override;

View File

@ -87,10 +87,10 @@ void RunBenchmark(wxWindow *parent)
{
/*
int action = AudacityMessageBox(
_("This will close all project windows (without saving)\nand open the Audacity Benchmark dialog.\n\nAre you sure you want to do this?"),
_("Benchmark"),
wxYES_NO | wxICON_EXCLAMATION,
NULL);
XO("This will close all project windows (without saving)\nand open the Audacity Benchmark dialog.\n\nAre you sure you want to do this?"),
XO("Benchmark"),
wxYES_NO | wxICON_EXCLAMATION,
NULL);
if (action != wxYES)
return;
@ -328,17 +328,20 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
mRandSeedStr.ToLong(&randSeed);
if (blockSize < 1 || blockSize > 1024) {
AudacityMessageBox(_("Block size should be in the range 1 - 1024 KB."));
AudacityMessageBox(
XO("Block size should be in the range 1 - 1024 KB.") );
return;
}
if (numEdits < 1 || numEdits > 10000) {
AudacityMessageBox(_("Number of edits should be in the range 1 - 10000."));
AudacityMessageBox(
XO("Number of edits should be in the range 1 - 10000.") );
return;
}
if (dataSize < 1 || dataSize > 2000) {
AudacityMessageBox(_("Test data size should be in the range 1 - 2000 MB."));
AudacityMessageBox(
XO("Test data size should be in the range 1 - 2000 MB.") );
return;
}

View File

@ -568,8 +568,10 @@ void DependencyDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
if (mIsSaving)
{
int ret = AudacityMessageBox(
_("If you proceed, your project will not be saved to disk. Is this what you want?"),
_("Cancel Save"), wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT, this);
XO(
"If you proceed, your project will not be saved to disk. Is this what you want?"),
XO("Cancel Save"),
wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT, this);
if (ret != wxYES)
return;
}
@ -607,22 +609,23 @@ bool ShowDependencyDialogIfNeeded(AudacityProject *project,
if (aliasedFiles.empty()) {
if (!isSaving)
{
wxString msg =
auto msg =
#ifdef EXPERIMENTAL_OD_DATA
_("Your project is currently self-contained; it does not depend on any external audio files. \
XO("Your project is currently self-contained; it does not depend on any external audio files. \
\n\nIf you change the project to a state that has external dependencies on imported \
files, it will no longer be self-contained. If you then Save without copying those files in, \
you may lose data.");
#else
_("Your project is self-contained; it does not depend on any external audio files. \
XO("Your project is self-contained; it does not depend on any external audio files. \
\n\nSome older Audacity projects may not be self-contained, and care \n\
is needed to keep their external dependencies in the right place.\n\
New projects will be self-contained and are less risky.");
#endif
AudacityMessageBox(msg,
_("Dependency Check"),
wxOK | wxICON_INFORMATION,
pWindow);
AudacityMessageBox(
msg,
XO("Dependency Check"),
wxOK | wxICON_INFORMATION,
pWindow);
}
return true; // Nothing to do.
}

View File

@ -102,11 +102,11 @@ void FFmpegStartup()
{
if (enabled)
{
AudacityMessageBox(_(
AudacityMessageBox(XO(
"FFmpeg was configured in Preferences and successfully loaded before, \
\nbut this time Audacity failed to load it at startup. \
\n\nYou may want to go back to Preferences > Libraries and re-configure it."),
_("FFmpeg startup failed"));
XO("FFmpeg startup failed"));
}
}
}
@ -745,10 +745,10 @@ bool FFmpegLibs::LoadLibs(wxWindow * WXUNUSED(parent), bool showerr)
*/
// Oh well, just give up
if (!ValidLibsLoaded()) {
wxString msg = _("Failed to find compatible FFmpeg libraries.");
auto msg = XO("Failed to find compatible FFmpeg libraries.");
if (showerr)
AudacityMessageBox(msg);
wxLogError(msg);
AudacityMessageBox( msg );
wxLogError(msg.Debug());
return false;
}

View File

@ -328,10 +328,12 @@ int SFFileCloser::operator() (SNDFILE *sf) const
if (err) {
char buffer[1000];
sf_error_str(sf, buffer, 1000);
AudacityMessageBox(wxString::Format
AudacityMessageBox(
/* i18n-hint: %s will be the error message from libsndfile */
(_("Error (file may not have been written): %s"),
buffer));
XO( "Error (file may not have been written): %s" )
// Not attempting to localize error messages
// from the library
.Format( buffer ));
}
return err;
}

View File

@ -614,7 +614,9 @@ char *FileNames::VerifyFilename(const wxString &s, bool input)
wxFileName ff(name);
wxString ext;
while ((char *) (const char *)name.mb_str() == NULL) {
AudacityMessageBox(_("The specified filename could not be converted due to Unicode character use."));
AudacityMessageBox(
XO(
"The specified filename could not be converted due to Unicode character use."));
ext = ff.GetExt();
name = FileNames::SelectFile(FileNames::Operation::_None,

View File

@ -612,7 +612,9 @@ void FrequencyPlotDialog::GetAudio()
}
else {
if (track->GetRate() != mRate) {
AudacityMessageBox(_("To plot the spectrum, all selected tracks must be the same sample rate."));
AudacityMessageBox(
XO(
"To plot the spectrum, all selected tracks must be the same sample rate.") );
mData.reset();
mDataLen = 0;
return;
@ -632,10 +634,10 @@ void FrequencyPlotDialog::GetAudio()
return;
if (warning) {
wxString msg;
msg.Printf(_("Too much audio was selected. Only the first %.1f seconds of audio will be analyzed."),
(mDataLen / mRate));
AudacityMessageBox(msg);
auto msg = XO(
"Too much audio was selected. Only the first %.1f seconds of audio will be analyzed.")
.Format(mDataLen / mRate);
AudacityMessageBox( msg );
}
}
@ -1080,8 +1082,7 @@ void FrequencyPlotDialog::OnExport(wxCommandEvent & WXUNUSED(event))
#endif
f.Open();
if (!f.IsOpened()) {
AudacityMessageBox( wxString::Format(
_("Couldn't write to file: %s"), fName ) );
AudacityMessageBox( XO("Couldn't write to file: %s").Format( fName ) );
return;
}

View File

@ -644,7 +644,7 @@ void LabelDialog::OnImport(wxCommandEvent & WXUNUSED(event))
f.Open(fileName);
if (!f.IsOpened()) {
AudacityMessageBox(
wxString::Format( _("Could not open file: %s"), fileName ));
XO("Could not open file: %s").Format( fileName ) );
}
else {
// Create a temporary label track and load the labels
@ -669,7 +669,7 @@ void LabelDialog::OnExport(wxCommandEvent & WXUNUSED(event))
// Silly user (could just disable the button, but that's a hassle ;-))
if (cnt == 0) {
AudacityMessageBox(_("No labels to export."));
AudacityMessageBox( XO("No labels to export.") );
return;
}
@ -713,7 +713,7 @@ void LabelDialog::OnExport(wxCommandEvent & WXUNUSED(event))
f.Open();
if (!f.IsOpened()) {
AudacityMessageBox(
wxString::Format( _("Couldn't write to file: %s"), fName ) );
XO("Couldn't write to file: %s").Format( fName ) );
return;
}

View File

@ -515,7 +515,7 @@ void LabelTrack::Import(wxTextFile & in)
catch(const LabelStruct::BadFormatException&) { error = true; }
}
if (error)
::AudacityMessageBox( _("One or more saved labels could not be read.") );
::AudacityMessageBox( XO("One or more saved labels could not be read.") );
SortLabels();
}

View File

@ -123,15 +123,14 @@ void LangChoiceDialog::OnOk(wxCommandEvent & WXUNUSED(event))
}
if (mLang.Left(2) != slang.Left(2)) {
wxString msg;
/* i18n-hint: The %s's are replaced by translated and untranslated
* versions of language names. */
msg.Printf(_("The language you have chosen, %s (%s), is not the same as the system language, %s (%s)."),
mLangNames[ndx].Translation(),
auto msg = XO("The language you have chosen, %s (%s), is not the same as the system language, %s (%s).")
.Format(mLangNames[ndx].Translation(),
mLang,
sname,
slang);
if (AudacityMessageBox(msg, _("Confirm"), wxYES_NO) == wxNO) {
if ( wxNO == AudacityMessageBox( msg, XO("Confirm"), wxYES_NO ) ) {
return;
}
}

View File

@ -300,8 +300,11 @@ bool ConvertLegacyProjectFile(const wxFileName &filename)
xmlFile.EndTag(wxT("audacityproject"));
xmlFile.Commit();
::AudacityMessageBox(wxString::Format(_("Converted a 1.0 project file to the new format.\nThe old file has been saved as '%s'"), xmlFile.GetBackupName()),
_("Opening Audacity Project"));
::AudacityMessageBox(
XO(
"Converted a 1.0 project file to the new format.\nThe old file has been saved as '%s'")
.Format( xmlFile.GetBackupName() ),
XO("Opening Audacity Project"));
return true;
} );

View File

@ -112,7 +112,11 @@ bool Module::Load()
tVersionFn versionFn = (tVersionFn)(mLib->GetSymbol(wxT(versionFnName)));
if (versionFn == NULL){
wxString ShortName = wxFileName( mName ).GetName();
AudacityMessageBox(wxString::Format(_("The module %s does not provide a version string.\nIt will not be loaded."), ShortName), _("Module Unsuitable"));
AudacityMessageBox(
XO(
"The module %s does not provide a version string.\nIt will not be loaded.")
.Format( ShortName),
XO("Module Unsuitable"));
wxLogMessage(wxString::Format(_("The module %s does not provide a version string. It will not be loaded."), mName));
mLib->Unload();
return false;
@ -121,7 +125,11 @@ bool Module::Load()
wxString moduleVersion = versionFn();
if( moduleVersion != AUDACITY_VERSION_STRING) {
wxString ShortName = wxFileName( mName ).GetName();
AudacityMessageBox(wxString::Format(_("The module %s is matched with Audacity version %s.\n\nIt will not be loaded."), ShortName, moduleVersion), _("Module Unsuitable"));
AudacityMessageBox(
XO(
"The module %s is matched with Audacity version %s.\n\nIt will not be loaded.")
.Format( ShortName, moduleVersion),
XO("Module Unsuitable"));
wxLogMessage(wxString::Format(_("The module %s is matched with Audacity version %s. It will not be loaded."), mName, moduleVersion));
mLib->Unload();
return false;

View File

@ -1034,10 +1034,9 @@ void PluginRegistrationDialog::OnOK(wxCommandEvent & WXUNUSED(evt))
}
}
if (!errMsgs.empty())
AudacityMessageBox( wxString::Format(
_("Effect or Command at %s failed to register:\n%s"),
path, errMsgs
) );
AudacityMessageBox(
XO("Effect or Command at %s failed to register:\n%s")
.Format( path, errMsgs ) );
}
else if (item.state == STATE_New)
{
@ -1836,11 +1835,10 @@ bool PluginManager::DropFile(const wxString &fileName)
if ( dst.Exists() ) {
// Query whether to overwrite
bool overwrite = (wxYES == ::AudacityMessageBox(
wxString::Format(_("Overwrite the plug-in file %s?"),
dst.GetFullPath() ),
_("Plug-in already exists"),
wxYES_NO
) );
XO("Overwrite the plug-in file %s?")
.Format( dst.GetFullPath() ),
XO("Plug-in already exists"),
wxYES_NO ) );
if ( !overwrite )
return true;
}
@ -1861,7 +1859,7 @@ bool PluginManager::DropFile(const wxString &fileName)
if (!copied) {
::AudacityMessageBox(
_("Plug-in file is in use. Failed to overwrite"));
XO("Plug-in file is in use. Failed to overwrite") );
return true;
}
@ -1881,26 +1879,24 @@ bool PluginManager::DropFile(const wxString &fileName)
});
if ( ! nPlugIns ) {
// Unlikely after the dry run succeeded
::AudacityMessageBox( wxString::Format(
_("Failed to register:\n%s"), errMsg ) );
::AudacityMessageBox(
XO("Failed to register:\n%s").Format( errMsg ) );
return true;
}
// Ask whether to enable the plug-ins
if (auto nIds = ids.size()) {
auto message = wxPLURAL(
"Enable this plug-in?",
"Enable these plug-ins?",
"Enable this plug-in?\n",
"Enable these plug-ins?\n",
0
)( nIds ).Translation();
message += wxT("\n");
)( nIds );
for (const auto &name : names)
message += name + wxT("\n");
message.Join( Verbatim( name ), wxT("\n") );
bool enable = (wxYES == ::AudacityMessageBox(
message,
_("Enable new plug-ins"),
wxYES_NO
) );
XO("Enable new plug-ins"),
wxYES_NO ) );
for (const auto &id : ids)
mPlugins[id].SetEnabled(enable);
// Make changes to enabled status persist:

View File

@ -222,12 +222,11 @@ bool CheckWritablePreferences()
return gPrefs->Write("/TEST", true) && gPrefs->Flush();
}
wxString UnwritablePreferencesErrorMessage( const wxFileName &configFileName )
TranslatableString UnwritablePreferencesErrorMessage( const wxFileName &configFileName )
{
return wxString::Format(
_("Audacity cannot start because the settings file at %s is not writable."),
configFileName.GetFullPath()
);
return
XO("Audacity cannot start because the settings file at %s is not writable.")
.Format(configFileName.GetFullPath());
}
void FinishPreferences()

View File

@ -42,7 +42,7 @@ class wxFileName;
void InitPreferences( const wxFileName &configFileName );
bool CheckWritablePreferences();
wxString UnwritablePreferencesErrorMessage( const wxFileName &configFileName );
TranslatableString UnwritablePreferencesErrorMessage( const wxFileName &configFileName );
void FinishPreferences();
class AudacityPrefs;

View File

@ -156,8 +156,10 @@ void HandlePrint(
AudacityPrintout printout(name, tracks, panel);
if (!printer.Print(parent, &printout, true)) {
if (wxPrinter::GetLastError() == wxPRINTER_ERROR) {
AudacityMessageBox(_("There was a problem printing."),
_("Print"), wxOK);
AudacityMessageBox(
XO("There was a problem printing."),
XO("Print"),
wxOK);
}
else {
// Do nothing, the user cancelled...

View File

@ -381,9 +381,10 @@ other projects. \
// In auto-recover mode, we didn't do any ShowMultiDialog calls above, so put up an alert.
if (bAutoRecoverMode)
::AudacityMessageBox(
_("Project check found file inconsistencies during automatic recovery.\n\nSelect 'Help > Diagnostics > Show Log...' to see details."),
_("Warning: Problems in Automatic Recovery"),
wxOK | wxICON_EXCLAMATION);
XO(
"Project check found file inconsistencies during automatic recovery.\n\nSelect 'Help > Diagnostics > Show Log...' to see details."),
XO("Warning: Problems in Automatic Recovery"),
wxOK | wxICON_EXCLAMATION);
}
MissingAliasFilesDialog::SetShouldShow(true);

View File

@ -137,8 +137,8 @@ void ProjectFileIO::SetProjectTitle( int number)
// Most of this string was duplicated 3 places. Made the warning consistent in this global.
// The %s is to be filled with the version string.
// PRL: Do not statically allocate a string in _() !
static wxString gsLegacyFileWarning() { return
_("This file was saved by Audacity version %s. The format has changed. \
static TranslatableString gsLegacyFileWarning() { return
XO("This file was saved by Audacity version %s. The format has changed. \
\n\nAudacity can try to open and save this file, but saving it in this \
\nversion will then prevent any 1.2 or earlier version opening it. \
\n\nAudacity might corrupt the file in opening it, so you should \
@ -150,15 +150,15 @@ bool ProjectFileIO::WarnOfLegacyFile( )
{
auto &project = mProject;
auto &window = GetProjectFrame( project );
wxString msg;
msg.Printf(gsLegacyFileWarning(), _("1.0 or earlier"));
auto msg = gsLegacyFileWarning().Format( XO("1.0 or earlier") );
// Stop icon, and choose 'NO' by default.
int action =
AudacityMessageBox(msg,
_("Warning - Opening Old Project File"),
wxYES_NO | wxICON_STOP | wxNO_DEFAULT | wxCENTRE,
&window);
AudacityMessageBox(
msg,
XO("Warning - Opening Old Project File"),
wxYES_NO | wxICON_STOP | wxNO_DEFAULT | wxCENTRE,
&window);
return (action != wxNO);
}
@ -278,10 +278,12 @@ bool ProjectFileIO::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
{
projName = project.GetProjectName() + wxT("_data");
if (!dirManager.SetProject(projPath, projName, false)) {
AudacityMessageBox(wxString::Format(_("Couldn't find the project data folder: \"%s\""),
projName),
_("Error Opening Project"),
wxOK | wxCENTRE, &window);
AudacityMessageBox(
XO("Couldn't find the project data folder: \"%s\"")
.Format( projName ),
XO("Error Opening Project"),
wxOK | wxCENTRE,
&window);
return false;
}
}
@ -333,14 +335,15 @@ bool ProjectFileIO::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
//!XMLValueChecker::IsGoodInt(fileVersion) ||
(fileVersion > wxT(AUDACITY_FILE_FORMAT_VERSION)))
{
wxString msg;
/* i18n-hint: %s will be replaced by the version number.*/
msg.Printf(_("This file was saved using Audacity %s.\nYou are using Audacity %s. You may need to upgrade to a newer version to open this file."),
audacityVersion,
auto msg = XO("This file was saved using Audacity %s.\nYou are using Audacity %s. You may need to upgrade to a newer version to open this file.")
.Format(audacityVersion,
AUDACITY_VERSION_STRING);
AudacityMessageBox(msg,
_("Can't open project file"),
wxOK | wxICON_EXCLAMATION | wxCENTRE, &window);
AudacityMessageBox(
msg,
XO("Can't open project file"),
wxOK | wxICON_EXCLAMATION | wxCENTRE,
&window);
return false;
}
@ -362,18 +365,17 @@ bool ProjectFileIO::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
bIsVeryOld |= wxAtoi( fileVersion )==0;
// Specifically detect older versions of Audacity
if ( bIsOld | bIsVeryOld ) {
wxString msg;
msg.Printf(gsLegacyFileWarning(), audacityVersion);
auto msg = gsLegacyFileWarning().Format( audacityVersion );
int icon_choice = wxICON_EXCLAMATION;
if( bIsVeryOld )
// Stop icon, and choose 'NO' by default.
icon_choice = wxICON_STOP | wxNO_DEFAULT;
int action =
AudacityMessageBox(msg,
_("Warning - Opening Old Project File"),
wxYES_NO | icon_choice | wxCENTRE,
&window);
int action = AudacityMessageBox(
msg,
XO("Warning - Opening Old Project File"),
wxYES_NO | icon_choice | wxCENTRE,
&window);
if (action == wxNO)
return false;
}
@ -607,9 +609,11 @@ void ProjectFileIO::AutoSave()
if (!wxRenameFile(fn + wxT(".tmp"), fn + wxT(".autosave")))
{
AudacityMessageBox(
wxString::Format( _("Could not create autosave file: %s"),
fn + wxT(".autosave") ),
_("Error"), wxICON_STOP, &window);
XO("Could not create autosave file: %s")
.Format( fn + wxT(".autosave") ),
XO("Error"),
wxICON_STOP,
&window);
return;
}
@ -630,9 +634,11 @@ void ProjectFileIO::DeleteCurrentAutoSaveFile()
if (!wxRemoveFile(mAutoSaveFileName))
{
AudacityMessageBox(
wxString::Format(
_("Could not remove old autosave file: %s"), mAutoSaveFileName ),
_("Error"), wxICON_STOP, &window);
XO("Could not remove old autosave file: %s")
.Format( mAutoSaveFileName ),
XO("Error"),
wxICON_STOP,
&window);
return;
}
}

View File

@ -155,8 +155,9 @@ auto ProjectFileManager::ReadProjectFile( const FilePath &fileName )
auto message = AutoSaveFile::FailureMessage( fileName );
AudacityMessageBox(
message,
_("Error decoding file"),
wxOK | wxCENTRE, &window );
XO("Error decoding file"),
wxOK | wxCENTRE,
&window );
// Important: Prevent deleting any temporary files!
DirManager::SetDontDeleteTempFiles();
return { true };
@ -369,9 +370,12 @@ bool ProjectFileManager::DoSave (const bool fromSaveAs,
{
if ( UndoManager::Get( proj ).UnsavedChanges()
&& settings.EmptyCanBeDirty()) {
int result = AudacityMessageBox(_("Your project is now empty.\nIf saved, the project will have no tracks.\n\nTo save any previously open tracks:\nClick 'No', Edit > Undo until all tracks\nare open, then File > Save Project.\n\nSave anyway?"),
_("Warning - Empty Project"),
wxYES_NO | wxICON_QUESTION, &window);
int result = AudacityMessageBox(
XO(
"Your project is now empty.\nIf saved, the project will have no tracks.\n\nTo save any previously open tracks:\nClick 'No', Edit > Undo until all tracks\nare open, then File > Save Project.\n\nSave anyway?"),
XO("Warning - Empty Project"),
wxYES_NO | wxICON_QUESTION,
&window);
if (result == wxNO)
return false;
}
@ -410,9 +414,12 @@ bool ProjectFileManager::DoSave (const bool fromSaveAs,
if ( !wxRenameFile(fileName, safetyFileName) ) {
AudacityMessageBox(
wxString::Format(
_("Audacity failed to write file %s.\nPerhaps disk is full or not writable."), safetyFileName ),
_("Error Writing to File"), wxICON_STOP, &window);
XO(
"Audacity failed to write file %s.\nPerhaps disk is full or not writable.")
.Format( safetyFileName ),
XO("Error Writing to File"),
wxICON_STOP,
&window);
return false;
}
}
@ -431,10 +438,13 @@ bool ProjectFileManager::DoSave (const bool fromSaveAs,
// strOtherNamesArray is a temporary array of file names, used only when
// saving compressed
if (!success) {
AudacityMessageBox(wxString::Format(_("Could not save project. Perhaps %s \nis not writable or the disk is full."),
project),
_("Error Saving Project"),
wxICON_ERROR, &window);
AudacityMessageBox(
XO(
"Could not save project. Perhaps %s \nis not writable or the disk is full.")
.Format( project ),
XO("Error Saving Project"),
wxICON_ERROR,
&window);
// Make the export of tracks succeed all-or-none.
auto dir = project + wxT("_data");
@ -455,11 +465,13 @@ bool ProjectFileManager::DoSave (const bool fromSaveAs,
projPath = wxPathOnly(project);
if( !wxDir::Exists( projPath ) ){
AudacityMessageBox(wxString::Format(
_("Could not save project. Path not found. Try creating \ndirectory \"%s\" before saving project with this name."),
projPath),
_("Error Saving Project"),
wxICON_ERROR, &window);
AudacityMessageBox(
XO(
"Could not save project. Path not found. Try creating \ndirectory \"%s\" before saving project with this name.")
.Format( projPath ),
XO("Error Saving Project"),
wxICON_ERROR,
&window);
return (success = false);
}
@ -886,17 +898,18 @@ For an audio file that will open in other apps, use 'Export'.\n");
if (mayOverwrite > 0) {
/* i18n-hint: In each case, %s is the name
of the file being overwritten.*/
wxString Message = wxString::Format(_("\
auto Message = XO("\
Do you want to overwrite the project:\n\"%s\"?\n\n\
If you select \"Yes\" the project\n\"%s\"\n\
will be irreversibly overwritten."), fName, fName);
will be irreversibly overwritten.").Format( fName, fName );
// For safety, there should NOT be an option to hide this warning.
int result = AudacityMessageBox(Message,
/* i18n-hint: Heading: A warning that a project is about to be overwritten.*/
_("Overwrite Project Warning"),
wxYES_NO | wxNO_DEFAULT | wxICON_WARNING,
&window);
int result = AudacityMessageBox(
Message,
/* i18n-hint: Heading: A warning that a project is about to be overwritten.*/
XO("Overwrite Project Warning"),
wxYES_NO | wxNO_DEFAULT | wxICON_WARNING,
&window);
if (result != wxYES) {
return false;
}
@ -1135,11 +1148,14 @@ bool ProjectFileManager::IsAlreadyOpen(const FilePath &projPathName)
return newProjPathName.SameAs(wxFileNameWrapper{ ptr->GetFileName() });
} );
if (iter != finish) {
wxString errMsg =
wxString::Format(_("%s is already open in another window."),
newProjPathName.GetName());
wxLogError(errMsg);
AudacityMessageBox(errMsg, _("Error Opening Project"), wxOK | wxCENTRE);
auto errMsg =
XO("%s is already open in another window.")
.Format( newProjPathName.GetName() );
wxLogError(errMsg.Translation()); //Debug?
AudacityMessageBox(
errMsg,
XO("Error Opening Project"),
wxOK | wxCENTRE);
return true;
}
return false;
@ -1289,17 +1305,20 @@ void ProjectFileManager::OpenFile(const FilePath &fileNameArg, bool addtohistory
if (fileName.Lower().EndsWith(wxT(".aup.bak")))
{
AudacityMessageBox(
_("You are trying to open an automatically created backup file.\nDoing this may result in severe data loss.\n\nPlease open the actual Audacity project file instead."),
_("Warning - Backup File Detected"),
wxOK | wxCENTRE, &window);
XO(
"You are trying to open an automatically created backup file.\nDoing this may result in severe data loss.\n\nPlease open the actual Audacity project file instead."),
XO("Warning - Backup File Detected"),
wxOK | wxCENTRE,
&window);
return;
}
if (!::wxFileExists(fileName)) {
AudacityMessageBox(
wxString::Format( _("Could not open file: %s"), fileName ),
_("Error Opening File"),
wxOK | wxCENTRE, &window);
XO("Could not open file: %s").Format( fileName ),
XO("Error Opening File"),
wxOK | wxCENTRE,
&window);
return;
}
@ -1313,16 +1332,19 @@ void ProjectFileManager::OpenFile(const FilePath &fileNameArg, bool addtohistory
wxFFile ff(fileName, wxT("rb"));
if (!ff.IsOpened()) {
AudacityMessageBox(
wxString::Format( _("Could not open file: %s"), fileName ),
_("Error opening file"),
wxOK | wxCENTRE, &window);
XO("Could not open file: %s").Format( fileName ),
XO("Error opening file"),
wxOK | wxCENTRE,
&window);
return;
}
int numRead = ff.Read(buf, 15);
if (numRead != 15) {
AudacityMessageBox(wxString::Format(_("File may be invalid or corrupted: \n%s"),
fileName), _("Error Opening File or Project"),
wxOK | wxCENTRE, &window);
AudacityMessageBox(
XO("File may be invalid or corrupted: \n%s").Format( fileName ),
XO("Error Opening File or Project"),
wxOK | wxCENTRE,
&window);
ff.Close();
return;
}
@ -1339,9 +1361,12 @@ void ProjectFileManager::OpenFile(const FilePath &fileNameArg, bool addtohistory
// Convert to the NEW format.
bool success = ConvertLegacyProjectFile(wxFileName{ fileName });
if (!success) {
AudacityMessageBox(_("Audacity was unable to convert an Audacity 1.0 project to the new project format."),
_("Error Opening Project"),
wxOK | wxCENTRE, &window);
AudacityMessageBox(
XO(
"Audacity was unable to convert an Audacity 1.0 project to the new project format."),
XO("Error Opening Project"),
wxOK | wxCENTRE,
&window);
return;
}
else {
@ -1455,8 +1480,11 @@ void ProjectFileManager::OpenFile(const FilePath &fileNameArg, bool addtohistory
history.PushState(XO("Project was recovered"), XO("Recover"));
if (!wxRemoveFile(fileName))
AudacityMessageBox(_("Could not remove old auto save file"),
_("Error"), wxICON_STOP, &window);
AudacityMessageBox(
XO("Could not remove old auto save file"),
XO("Error"),
wxICON_STOP,
&window);
}
else
{

View File

@ -653,16 +653,18 @@ void ProjectManager::OnCloseWindow(wxCloseEvent & event)
if ( UndoManager::Get( project ).UnsavedChanges() ) {
TitleRestorer Restorer( window, project );// RAII
/* i18n-hint: The first %s numbers the project, the second %s is the project name.*/
wxString Title = wxString::Format(_("%sSave changes to %s?"), Restorer.sProjNumber, Restorer.sProjName);
wxString Message = _("Save project before closing?");
auto Title = XO("%sSave changes to %s?")
.Format( Restorer.sProjNumber, Restorer.sProjName );
auto Message = XO("Save project before closing?");
if( !bHasTracks )
{
Message += _("\nIf saved, the project will have no tracks.\n\nTo save any previously open tracks:\nCancel, Edit > Undo until all tracks\nare open, then File > Save Project.");
Message += XO("\nIf saved, the project will have no tracks.\n\nTo save any previously open tracks:\nCancel, Edit > Undo until all tracks\nare open, then File > Save Project.");
}
int result = AudacityMessageBox( Message,
Title,
wxYES_NO | wxCANCEL | wxICON_QUESTION,
&window);
int result = AudacityMessageBox(
Message,
Title,
wxYES_NO | wxCANCEL | wxICON_QUESTION,
&window);
if (result == wxCANCEL || (result == wxYES &&
!GuardedCall<bool>( [&]{ return projectFileManager.Save(); } )

View File

@ -1018,12 +1018,14 @@ void Sequence::WriteXML(XMLWriter &xmlFile) const
// editing operation that caused this, not fixing
// the problem but moving the point of detection earlier if we
// find a reproducible case.
wxString sMsg =
wxString::Format(
_("Sequence has block file exceeding maximum %s samples per block.\nTruncating to this maximum length."),
Internat::ToString(((wxLongLong)mMaxSamples).ToDouble(), 0));
AudacityMessageBox(sMsg, _("Warning - Truncating Overlong Block File"), wxICON_EXCLAMATION | wxOK);
wxLogWarning(sMsg);
auto sMsg =
XO("Sequence has block file exceeding maximum %s samples per block.\nTruncating to this maximum length.")
.Format( Internat::ToString(((wxLongLong)mMaxSamples).ToDouble(), 0) );
AudacityMessageBox(
sMsg,
XO("Warning - Truncating Overlong Block File"),
wxICON_EXCLAMATION | wxOK);
wxLogWarning(sMsg.Translation()); //Debug?
bb.f->SetLength(mMaxSamples);
}

View File

@ -1182,7 +1182,9 @@ void TagsEditorDialog::OnEdit(wxCommandEvent & WXUNUSED(event))
wxFileName fn(FileNames::DataDir(), wxT("genres.txt"));
wxFile f(fn.GetFullPath(), wxFile::write);
if (!f.IsOpened() || !f.Write(tc->GetValue())) {
AudacityMessageBox(_("Unable to save genre file."), _("Reset Genres"));
AudacityMessageBox(
XO("Unable to save genre file."),
XO("Reset Genres") );
return;
}
@ -1193,9 +1195,10 @@ void TagsEditorDialog::OnEdit(wxCommandEvent & WXUNUSED(event))
void TagsEditorDialog::OnReset(wxCommandEvent & WXUNUSED(event))
{
int id = AudacityMessageBox(_("Are you sure you want to reset the genre list to defaults?"),
_("Reset Genres"),
wxYES_NO);
int id = AudacityMessageBox(
XO("Are you sure you want to reset the genre list to defaults?"),
XO("Reset Genres"),
wxYES_NO);
if (id == wxNO) {
return;
@ -1209,7 +1212,9 @@ void TagsEditorDialog::OnReset(wxCommandEvent & WXUNUSED(event))
(!tf.Exists() && tf.Create());
if (!open) {
AudacityMessageBox(_("Unable to open genre file."), _("Reset Genres"));
AudacityMessageBox(
XO("Unable to open genre file."),
XO("Reset Genres") );
mLocal.LoadGenres();
return;
}
@ -1221,7 +1226,9 @@ void TagsEditorDialog::OnReset(wxCommandEvent & WXUNUSED(event))
}
if (!tf.Write()) {
AudacityMessageBox(_("Unable to save genre file."), _("Reset Genres"));
AudacityMessageBox(
XO("Unable to save genre file."),
XO("Reset Genres") );
mLocal.LoadGenres();
return;
}
@ -1268,10 +1275,11 @@ void TagsEditorDialog::OnLoad(wxCommandEvent & WXUNUSED(event))
XMLFileReader reader;
if (!reader.Parse(&mLocal, fn)) {
// Inform user of load failure
AudacityMessageBox(reader.GetErrorStr().Translation(),
_("Error Loading Metadata"),
wxOK | wxCENTRE,
this);
AudacityMessageBox(
reader.GetErrorStr(),
XO("Error Loading Metadata"),
wxOK | wxCENTRE,
this);
}
// Restore title

View File

@ -737,13 +737,14 @@ void ThemeBase::CreateImageCache( bool bBinarySave )
// Perhaps we should prompt the user if they are overwriting
// an existing theme cache?
#if 0
if( wxFileExist( FileName ))
if( wxFileExists( FileName ))
{
AudacityMessageBox(
wxString::Format(
// _("Theme cache file:\n %s\nalready exists.\nAre you sure you want to replace it?"),
FileName )
);
auto message =
// XO(
//"Theme cache file:\n %s\nalready exists.\nAre you sure you want to replace it?")
// .Format( FileName );
TranslatableString{ FileName };
AudacityMessageBox( message );
return;
}
#endif
@ -758,19 +759,17 @@ void ThemeBase::CreateImageCache( bool bBinarySave )
if( !ImageCache.SaveFile( FileName, wxBITMAP_TYPE_PNG ))
{
AudacityMessageBox(
wxString::Format(
_("Audacity could not write file:\n %s."),
FileName ));
XO("Audacity could not write file:\n %s.")
.Format( FileName ));
return;
}
AudacityMessageBox(
wxString::Format(
/* i18n-hint: A theme is a consistent visual style across an application's
graphical user interface, including choices of colors, and similarity of images
such as those on button controls. Audacity can load and save alternative
themes. */
_("Theme written to:\n %s."),
FileName ));
XO("Theme written to:\n %s.")
.Format( FileName ));
}
// ELSE saving to a C code textual version.
else
@ -780,24 +779,21 @@ void ThemeBase::CreateImageCache( bool bBinarySave )
if( !OutStream.OpenFile( FileName ))
{
AudacityMessageBox(
wxString::Format(
_("Audacity could not open file:\n %s\nfor writing."),
FileName ));
XO("Audacity could not open file:\n %s\nfor writing.")
.Format( FileName ));
return;
}
if( !ImageCache.SaveFile(OutStream, wxBITMAP_TYPE_PNG ) )
{
AudacityMessageBox(
wxString::Format(
_("Audacity could not write images to file:\n %s."),
FileName ));
XO("Audacity could not write images to file:\n %s.")
.Format( FileName ));
return;
}
AudacityMessageBox(
wxString::Format(
/* i18n-hint "Cee" means the C computer programming language */
_("Theme as Cee code written to:\n %s."),
FileName ));
/* i18n-hint "Cee" means the C computer programming language */
XO("Theme as Cee code written to:\n %s.")
.Format( FileName ));
}
}
@ -950,18 +946,16 @@ bool ThemeBase::ReadImageCache( teThemeType type, bool bOkIfNotFound)
if( bOkIfNotFound )
return false; // did not load the images, so return false.
AudacityMessageBox(
wxString::Format(
_("Audacity could not find file:\n %s.\nTheme not loaded."),
FileName ));
XO("Audacity could not find file:\n %s.\nTheme not loaded.")
.Format( FileName ));
return false;
}
if( !ImageCache.LoadFile( FileName, wxBITMAP_TYPE_PNG ))
{
/* i18n-hint: Do not translate png. It is the name of a file format.*/
AudacityMessageBox(
wxString::Format(
_("Audacity could not load file:\n %s.\nBad png format perhaps?"),
FileName ));
XO("Audacity could not load file:\n %s.\nBad png format perhaps?")
.Format( FileName ));
return false;
}
}
@ -998,7 +992,9 @@ bool ThemeBase::ReadImageCache( teThemeType type, bool bOkIfNotFound)
// was not a valid png image.
// Most likely someone edited it by mistake,
// Or some experiment is being tried with NEW formats for it.
AudacityMessageBox(_("Audacity could not read its default theme.\nPlease report the problem."));
AudacityMessageBox(
XO(
"Audacity could not read its default theme.\nPlease report the problem."));
return false;
}
//wxLogDebug("Read %i by %i", ImageCache.GetWidth(), ImageCache.GetHeight() );
@ -1082,9 +1078,9 @@ void ThemeBase::LoadComponents( bool bOkIfNotFound )
{
/* i18n-hint: Do not translate png. It is the name of a file format.*/
AudacityMessageBox(
wxString::Format(
_("Audacity could not load file:\n %s.\nBad png format perhaps?"),
FileName ));
XO(
"Audacity could not load file:\n %s.\nBad png format perhaps?")
.Format( FileName ));
return;
}
/// JKC: \bug (wxWidgets) A png may have been saved with alpha, but when you
@ -1105,8 +1101,10 @@ void ThemeBase::LoadComponents( bool bOkIfNotFound )
{
if( bOkIfNotFound )
return;
AudacityMessageBox(wxString::Format(_("None of the expected theme component files\n were found in:\n %s."),
FileNames::ThemeComponentsDir()));
AudacityMessageBox(
XO(
"None of the expected theme component files\n were found in:\n %s.")
.Format( FileNames::ThemeComponentsDir() ));
}
}
@ -1128,9 +1126,8 @@ void ThemeBase::SaveComponents()
if( !wxDirExists( FileNames::ThemeComponentsDir() ))
{
AudacityMessageBox(
wxString::Format(
_("Could not create directory:\n %s"),
FileNames::ThemeComponentsDir() ));
XO("Could not create directory:\n %s")
.Format( FileNames::ThemeComponentsDir() ) );
return;
}
}
@ -1156,11 +1153,11 @@ void ThemeBase::SaveComponents()
{
auto result =
AudacityMessageBox(
wxString::Format(
_("Some required files in:\n %s\nwere already present. Overwrite?"),
FileNames::ThemeComponentsDir()),
AudacityMessageBoxCaptionStr().Translation(),
wxYES_NO | wxNO_DEFAULT);
XO(
"Some required files in:\n %s\nwere already present. Overwrite?")
.Format( FileNames::ThemeComponentsDir() ),
AudacityMessageBoxCaptionStr(),
wxYES_NO | wxNO_DEFAULT);
if(result == wxNO)
return;
}
@ -1173,17 +1170,15 @@ void ThemeBase::SaveComponents()
if( !mImages[i].SaveFile( FileName, wxBITMAP_TYPE_PNG ))
{
AudacityMessageBox(
wxString::Format(
_("Audacity could not save file:\n %s"),
FileName ));
XO("Audacity could not save file:\n %s")
.Format( FileName ));
return;
}
}
}
AudacityMessageBox(
wxString::Format(
_("Theme written to:\n %s."),
FileNames::ThemeComponentsDir() ));
XO("Theme written to:\n %s.")
.Format( FileNames::ThemeComponentsDir() ) );
}

View File

@ -389,8 +389,10 @@ void TimerRecordDialog::OnOK(wxCommandEvent& WXUNUSED(event))
this->TransferDataFromWindow();
if (!m_TimeSpan_Duration.IsPositive())
{
AudacityMessageBox(_("Duration is zero. Nothing will be recorded."),
_("Error in Duration"), wxICON_EXCLAMATION | wxOK);
AudacityMessageBox(
XO("Duration is zero. Nothing will be recorded."),
XO("Error in Duration"),
wxICON_EXCLAMATION | wxOK);
return;
}
@ -398,15 +400,19 @@ void TimerRecordDialog::OnOK(wxCommandEvent& WXUNUSED(event))
wxString sTemp = m_fnAutoSaveFile.GetFullPath();
if (m_pTimerAutoSaveCheckBoxCtrl->IsChecked()) {
if (!m_fnAutoSaveFile.IsOk() || m_fnAutoSaveFile.IsDir()) {
AudacityMessageBox(_("Automatic Save path is invalid."),
_("Error in Automatic Save"), wxICON_EXCLAMATION | wxOK);
AudacityMessageBox(
XO("Automatic Save path is invalid."),
XO("Error in Automatic Save"),
wxICON_EXCLAMATION | wxOK);
return;
}
}
if (m_pTimerAutoExportCheckBoxCtrl->IsChecked()) {
if (!m_fnAutoExportFile.IsOk() || m_fnAutoExportFile.IsDir()) {
AudacityMessageBox(_("Automatic Export path is invalid."),
_("Error in Automatic Export"), wxICON_EXCLAMATION | wxOK);
AudacityMessageBox(
XO("Automatic Export path is invalid."),
XO("Error in Automatic Export"),
wxICON_EXCLAMATION | wxOK);
return;
}
}
@ -495,8 +501,10 @@ bool TimerRecordDialog::HaveFilesToRecover()
{
wxDir dir(FileNames::AutoSaveDir());
if (!dir.IsOpened()) {
AudacityMessageBox(_("Could not enumerate files in auto save directory."),
_("Error"), wxICON_STOP);
AudacityMessageBox(
XO("Could not enumerate files in auto save directory."),
XO("Error"),
wxICON_STOP);
return false;
}
@ -518,8 +526,10 @@ bool TimerRecordDialog::RemoveAllAutoSaveFiles()
{
// I don't think this error message is actually useful.
// -dmazzoni
//AudacityMessageBox(_("Could not remove auto save file: " + files[i]),
// _("Error"), wxICON_STOP);
//AudacityMessageBox(
// XO("Could not remove auto save file: %s)".Format( files[i] ),
// XO("Error"),
// wxICON_STOP);
return false;
}
}
@ -651,23 +661,23 @@ int TimerRecordDialog::ExecutePostRecordActions(bool bWasStopped) {
if (iPostRecordAction == POST_TIMER_RECORD_NOTHING) {
// If there is no post-record action then we can show a message indicating what has been done
wxString sMessage = (bWasStopped ? _("Timer Recording stopped.") :
_("Timer Recording completed."));
auto sMessage = (bWasStopped ? XO("Timer Recording stopped.") :
XO("Timer Recording completed."));
if (m_bAutoSaveEnabled) {
if (bSaveOK) {
sMessage.Printf(_("%s\n\nRecording saved: %s"),
sMessage = XO("%s\n\nRecording saved: %s").Format(
sMessage, m_fnAutoSaveFile.GetFullPath());
} else {
sMessage.Printf(_("%s\n\nError saving recording."), sMessage);
sMessage = XO("%s\n\nError saving recording.").Format( sMessage );
}
}
if (m_bAutoExportEnabled) {
if (bExportOK) {
sMessage.Printf(_("%s\n\nRecording exported: %s"),
sMessage = XO("%s\n\nRecording exported: %s").Format(
sMessage, m_fnAutoExportFile.GetFullPath());
} else {
sMessage.Printf(_("%s\n\nError exporting recording."), sMessage);
sMessage = XO("%s\n\nError exporting recording.").Format( sMessage );
}
}
@ -676,22 +686,28 @@ int TimerRecordDialog::ExecutePostRecordActions(bool bWasStopped) {
if ((iOverriddenAction != iPostRecordAction) &&
(iOverriddenAction != POST_TIMER_RECORD_NOTHING)) {
// Inform the user that we have overridden the selected action
sMessage.Printf(_("%s\n\n'%s' has been canceled due to the error(s) noted above."),
sMessage = XO("%s\n\n'%s' has been canceled due to the error(s) noted above.").Format(
sMessage,
m_pTimerAfterCompleteChoiceCtrl->GetString(iOverriddenAction));
}
// Show Error Message Box
AudacityMessageBox(sMessage, _("Error"), wxICON_EXCLAMATION | wxOK);
AudacityMessageBox(
sMessage,
XO("Error"),
wxICON_EXCLAMATION | wxOK);
} else {
if (bWasStopped && (iOverriddenAction != POST_TIMER_RECORD_NOTHING)) {
sMessage.Printf(_("%s\n\n'%s' has been canceled as the recording was stopped."),
sMessage = XO("%s\n\n'%s' has been canceled as the recording was stopped.").Format(
sMessage,
m_pTimerAfterCompleteChoiceCtrl->GetString(iOverriddenAction));
}
AudacityMessageBox(sMessage, _("Timer Recording"), wxICON_INFORMATION | wxOK);
AudacityMessageBox(
sMessage,
XO("Timer Recording"),
wxICON_INFORMATION | wxOK);
}
}

View File

@ -96,7 +96,7 @@ sampleCount VoiceKey::OnForward (
backwards by words. So 'key' is being used in the sense of an index.
This error message means that you've selected too short
a region of audio to be able to use this feature.*/
AudacityMessageBox(_("Selection is too small to use voice key."));
AudacityMessageBox( XO("Selection is too small to use voice key.") );
return start;
}
else {
@ -244,7 +244,7 @@ sampleCount VoiceKey::OnBackward (
if((mWindowSize) >= (len + 10).as_double() ){
AudacityMessageBox(_("Selection is too small to use voice key."));
AudacityMessageBox( XO("Selection is too small to use voice key.") );
return end;
}
else {
@ -388,7 +388,7 @@ sampleCount VoiceKey::OffForward (
{
if((mWindowSize) >= (len + 10).as_double() ){
AudacityMessageBox(_("Selection is too small to use voice key."));
AudacityMessageBox( XO("Selection is too small to use voice key.") );
return start;
}
@ -526,7 +526,7 @@ sampleCount VoiceKey::OffBackward (
if((mWindowSize) >= (len + 10).as_double() ){
AudacityMessageBox(_("Selection is too small to use voice key."));
AudacityMessageBox( XO("Selection is too small to use voice key.") );
return end;
}
else {

View File

@ -245,8 +245,7 @@ int AudacityCommand::MessageBox(
auto title = titleStr.empty()
? GetName()
: XO("%s: %s").Format( GetName(), titleStr );
return AudacityMessageBox(
message.Translation(), title.Translation(), style, mUIParent);
return AudacityMessageBox(message, title, style, mUIParent);
}
BEGIN_EVENT_TABLE(AudacityCommandDialog, wxDialogWrapper)

View File

@ -1417,10 +1417,11 @@ bool CommandManager::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
void CommandManager::HandleXMLEndTag(const wxChar *tag)
{
if (!wxStrcmp(tag, wxT("audacitykeyboard"))) {
AudacityMessageBox(wxString::Format(_("Loaded %d keyboard shortcuts\n"),
mXMLKeysRead),
_("Loading Keyboard Shortcuts"),
wxOK | wxCENTRE);
AudacityMessageBox(
XO("Loaded %d keyboard shortcuts\n")
.Format( mXMLKeysRead ),
XO("Loading Keyboard Shortcuts"),
wxOK | wxCENTRE);
}
}

View File

@ -253,7 +253,8 @@ void BriefCommandMessageTarget::EndField(){
void MessageBoxTarget::Update(const wxString &message)
{
AudacityMessageBox(message);
// Should these messages be localized?
AudacityMessageBox( Verbatim( message ) );
}

View File

@ -547,8 +547,7 @@ void ContrastDialog::OnExport(wxCommandEvent & WXUNUSED(event))
#endif
f.Open();
if (!f.IsOpened()) {
AudacityMessageBox(
wxString::Format( _("Couldn't write to file: %s"), fName) );
AudacityMessageBox( XO("Couldn't write to file: %s").Format( fName ) );
return;
}

View File

@ -2453,8 +2453,7 @@ int Effect::MessageBox( const TranslatableString& message,
auto title = titleStr.empty()
? GetName()
: XO("%s: %s").Format( GetName(), titleStr );
return AudacityMessageBox(
message.Translation(), title.Translation(), style, mUIParent );
return AudacityMessageBox( message, title, style, mUIParent );
}
BEGIN_EVENT_TABLE(EffectDialog, wxDialogWrapper)
@ -3445,9 +3444,10 @@ void EffectUIHost::OnDeletePreset(wxCommandEvent & evt)
{
auto preset = mUserPresets[evt.GetId() - kDeletePresetID];
int res = AudacityMessageBox(wxString::Format(_("Are you sure you want to delete \"%s\"?"), preset),
_("Delete Preset"),
wxICON_QUESTION | wxYES_NO);
int res = AudacityMessageBox(
XO("Are you sure you want to delete \"%s\"?").Format( preset ),
XO("Delete Preset"),
wxICON_QUESTION | wxYES_NO);
if (res == wxYES)
{
mEffect->RemovePrivateConfigSubgroup(mEffect->GetUserPresetsGroup(preset));

View File

@ -699,9 +699,11 @@ Effect *EffectManager::GetEffect(const PluginID & ID)
auto command = dynamic_cast<AudacityCommand *>(PluginManager::Get().GetInstance(ID));
if( !command )
AudacityMessageBox(wxString::Format(_("Attempting to initialize the following effect failed:\n\n%s\n\nMore information may be available in 'Help > Diagnostics > Show Log'"),
GetCommandName(ID).Translation()),
_("Effect failed to initialize"));
AudacityMessageBox(
XO(
"Attempting to initialize the following effect failed:\n\n%s\n\nMore information may be available in 'Help > Diagnostics > Show Log'")
.Format( GetCommandName(ID) ),
XO("Effect failed to initialize"));
return NULL;
}
@ -755,9 +757,11 @@ AudacityCommand *EffectManager::GetAudacityCommand(const PluginID & ID)
}
}
*/
AudacityMessageBox(wxString::Format(_("Attempting to initialize the following command failed:\n\n%s\n\nMore information may be available in 'Help > Diagnostics > Show Log'"),
GetCommandName(ID).Translation()),
_("Command failed to initialize"));
AudacityMessageBox(
XO(
"Attempting to initialize the following command failed:\n\n%s\n\nMore information may be available in 'Help > Diagnostics > Show Log'")
.Format( GetCommandName(ID) ),
XO("Command failed to initialize"));
return NULL;
}

View File

@ -1893,10 +1893,11 @@ void VSTEffect::ExportPresets()
else
{
// This shouldn't happen, but complain anyway
AudacityMessageBox(_("Unrecognized file extension."),
_("Error Saving VST Presets"),
wxOK | wxCENTRE,
mParent);
AudacityMessageBox(
XO("Unrecognized file extension."),
XO("Error Saving VST Presets"),
wxOK | wxCENTRE,
mParent);
return;
}
@ -1945,20 +1946,22 @@ void VSTEffect::ImportPresets()
else
{
// This shouldn't happen, but complain anyway
AudacityMessageBox(_("Unrecognized file extension."),
_("Error Loading VST Presets"),
wxOK | wxCENTRE,
mParent);
AudacityMessageBox(
XO("Unrecognized file extension."),
XO("Error Loading VST Presets"),
wxOK | wxCENTRE,
mParent);
return;
}
if (!success)
{
AudacityMessageBox(_("Unable to load presets file."),
_("Error Loading VST Presets"),
wxOK | wxCENTRE,
mParent);
AudacityMessageBox(
XO("Unable to load presets file."),
XO("Error Loading VST Presets"),
wxOK | wxCENTRE,
mParent);
return;
}
@ -3058,10 +3061,11 @@ bool VSTEffect::LoadFXB(const wxFileName & fn)
ArrayOf<unsigned char> data{ size_t(f.Length()) };
if (!data)
{
AudacityMessageBox(_("Unable to allocate memory when loading presets file."),
_("Error Loading VST Presets"),
wxOK | wxCENTRE,
mParent);
AudacityMessageBox(
XO("Unable to allocate memory when loading presets file."),
XO("Error Loading VST Presets"),
wxOK | wxCENTRE,
mParent);
return false;
}
unsigned char *bptr = data.get();
@ -3072,10 +3076,11 @@ bool VSTEffect::LoadFXB(const wxFileName & fn)
ssize_t len = f.Read((void *) bptr, f.Length());
if (f.Error())
{
AudacityMessageBox(_("Unable to read presets file."),
_("Error Loading VST Presets"),
wxOK | wxCENTRE,
mParent);
AudacityMessageBox(
XO("Unable to read presets file."),
XO("Error Loading VST Presets"),
wxOK | wxCENTRE,
mParent);
break;
}
@ -3229,10 +3234,11 @@ bool VSTEffect::LoadFXP(const wxFileName & fn)
ArrayOf<unsigned char> data{ size_t(f.Length()) };
if (!data)
{
AudacityMessageBox(_("Unable to allocate memory when loading presets file."),
_("Error Loading VST Presets"),
wxOK | wxCENTRE,
mParent);
AudacityMessageBox(
XO("Unable to allocate memory when loading presets file."),
XO("Error Loading VST Presets"),
wxOK | wxCENTRE,
mParent);
return false;
}
unsigned char *bptr = data.get();
@ -3243,10 +3249,11 @@ bool VSTEffect::LoadFXP(const wxFileName & fn)
ssize_t len = f.Read((void *) bptr, f.Length());
if (f.Error())
{
AudacityMessageBox(_("Unable to read presets file."),
_("Error Loading VST Presets"),
wxOK | wxCENTRE,
mParent);
AudacityMessageBox(
XO("Unable to read presets file."),
XO("Error Loading VST Presets"),
wxOK | wxCENTRE,
mParent);
break;
}
@ -3439,10 +3446,11 @@ bool VSTEffect::LoadXML(const wxFileName & fn)
if (!ok)
{
// Inform user of load failure
AudacityMessageBox(reader.GetErrorStr().Translation(),
_("Error Loading VST Presets"),
wxOK | wxCENTRE,
mParent);
AudacityMessageBox(
reader.GetErrorStr(),
XO("Error Loading VST Presets"),
wxOK | wxCENTRE,
mParent);
return false;
}
@ -3456,10 +3464,11 @@ void VSTEffect::SaveFXB(const wxFileName & fn)
wxFFile f(fullPath, wxT("wb"));
if (!f.IsOpened())
{
AudacityMessageBox(wxString::Format(_("Could not open file: \"%s\""), fullPath),
_("Error Saving VST Presets"),
wxOK | wxCENTRE,
mParent);
AudacityMessageBox(
XO("Could not open file: \"%s\"").Format( fullPath ),
XO("Error Saving VST Presets"),
wxOK | wxCENTRE,
mParent);
return;
}
@ -3523,10 +3532,11 @@ void VSTEffect::SaveFXB(const wxFileName & fn)
if (f.Error())
{
AudacityMessageBox(wxString::Format(_("Error writing to file: \"%s\""), fullPath),
_("Error Saving VST Presets"),
wxOK | wxCENTRE,
mParent);
AudacityMessageBox(
XO("Error writing to file: \"%s\"").Format( fullPath ),
XO("Error Saving VST Presets"),
wxOK | wxCENTRE,
mParent);
}
f.Close();
@ -3541,10 +3551,11 @@ void VSTEffect::SaveFXP(const wxFileName & fn)
wxFFile f(fullPath, wxT("wb"));
if (!f.IsOpened())
{
AudacityMessageBox(wxString::Format(_("Could not open file: \"%s\""), fullPath),
_("Error Saving VST Presets"),
wxOK | wxCENTRE,
mParent);
AudacityMessageBox(
XO("Could not open file: \"%s\"").Format( fullPath ),
XO("Error Saving VST Presets"),
wxOK | wxCENTRE,
mParent);
return;
}
@ -3556,10 +3567,11 @@ void VSTEffect::SaveFXP(const wxFileName & fn)
f.Write(buf.GetData(), buf.GetDataLen());
if (f.Error())
{
AudacityMessageBox(wxString::Format(_("Error writing to file: \"%s\""), fullPath),
_("Error Saving VST Presets"),
wxOK | wxCENTRE,
mParent);
AudacityMessageBox(
XO("Error writing to file: \"%s\"").Format( fullPath ),
XO("Error Saving VST Presets"),
wxOK | wxCENTRE,
mParent);
}
f.Close();
@ -3750,9 +3762,13 @@ bool VSTEffect::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
if (value != GetSymbol().Internal())
{
wxString msg;
msg.Printf(_("This parameter file was saved from %s. Continue?"), value);
int result = AudacityMessageBox(msg, wxT("Confirm"), wxYES_NO, mParent);
auto msg = XO("This parameter file was saved from %s. Continue?")
.Format( value );
int result = AudacityMessageBox(
msg,
XO("Confirm"),
wxYES_NO,
mParent );
if (result == wxNO)
{
return false;

View File

@ -1557,7 +1557,7 @@ bool LV2Effect::PopulateUI(wxWindow *parent)
mMaster = InitInstance(mSampleRate);
if (mMaster == NULL)
{
AudacityMessageBox(_("Couldn't instantiate effect"));
AudacityMessageBox( XO("Couldn't instantiate effect") );
return false;
}

View File

@ -552,14 +552,15 @@ bool Exporter::ExamineTracks()
}
if (mNumSelected == 0) {
wxString message;
TranslatableString message;
if(mSelectedOnly)
message = _("All selected audio is muted.");
message = XO("All selected audio is muted.");
else
message = _("All audio is muted.");
AudacityMessageBox(message,
_("Unable to export"),
wxOK | wxICON_INFORMATION);
message = XO("All audio is muted.");
AudacityMessageBox(
message,
XO("Unable to export"),
wxOK | wxICON_INFORMATION);
return false;
}
@ -695,13 +696,14 @@ bool Exporter::GetFilename()
// as an extension with no name, like just plain ".wav".
//
if (mFilename.GetName().Left(1) == wxT(".")) {
wxString prompt = wxString::Format(
_("Are you sure you want to export the file as \"%s\"?\n"),
mFilename.GetFullName() );
auto prompt =
XO("Are you sure you want to export the file as \"%s\"?\n")
.Format( mFilename.GetFullName() );
int action = AudacityMessageBox(prompt,
_("Warning"),
wxYES_NO | wxICON_EXCLAMATION);
int action = AudacityMessageBox(
prompt,
XO("Warning"),
wxYES_NO | wxICON_EXCLAMATION);
if (action != wxYES) {
continue;
}
@ -714,22 +716,23 @@ bool Exporter::GetFilename()
continue;
}
else if (!ext.empty() && !mPlugins[mFormat]->IsExtension(ext,mSubFormat) && ext.CmpNoCase(defext)) {
wxString prompt;
prompt.Printf(_("You are about to export a %s file with the name \"%s\".\n\nNormally these files end in \".%s\", and some programs will not open files with nonstandard extensions.\n\nAre you sure you want to export the file under this name?"),
mPlugins[mFormat]->GetFormat(mSubFormat),
auto prompt = XO("You are about to export a %s file with the name \"%s\".\n\nNormally these files end in \".%s\", and some programs will not open files with nonstandard extensions.\n\nAre you sure you want to export the file under this name?")
.Format(mPlugins[mFormat]->GetFormat(mSubFormat),
mFilename.GetFullName(),
defext);
int action = AudacityMessageBox(prompt,
_("Warning"),
wxYES_NO | wxICON_EXCLAMATION);
int action = AudacityMessageBox(
prompt,
XO("Warning"),
wxYES_NO | wxICON_EXCLAMATION);
if (action != wxYES) {
continue;
}
}
if (mFilename.GetFullPath().length() >= 256) {
AudacityMessageBox(_("Sorry, pathnames longer than 256 characters not supported."));
AudacityMessageBox(
XO( "Sorry, pathnames longer than 256 characters not supported.") );
continue;
}
@ -746,7 +749,7 @@ bool Exporter::GetFilename()
if (mFilename.GetFullPath() == aliasedFile.mFileName.GetFullPath() &&
!mFilename.FileExists()) {
// Warn and return to the dialog
AudacityMessageBox(_(
AudacityMessageBox(XO(
"You are attempting to overwrite an aliased file that is missing.\n\
The file cannot be written because the path is needed to restore the original audio to the project.\n\
Choose Help > Diagnostics > Check Dependencies to view the locations of all missing files.\n\
@ -759,14 +762,13 @@ If you still wish to export, please choose a different filename or folder."));
continue;
if (mFilename.FileExists()) {
wxString prompt;
auto prompt = XO("A file named \"%s\" already exists. Replace?")
.Format( mFilename.GetFullPath() );
prompt.Printf(_("A file named \"%s\" already exists. Replace?"),
mFilename.GetFullPath());
int action = AudacityMessageBox(prompt,
_("Warning"),
wxYES_NO | wxICON_EXCLAMATION);
int action = AudacityMessageBox(
prompt,
XO("Warning"),
wxYES_NO | wxICON_EXCLAMATION);
if (action != wxYES) {
continue;
}

View File

@ -386,8 +386,7 @@ ProgressResult ExportCL::Export(AudacityProject *project,
}
if (!rc) {
AudacityMessageBox(wxString::Format(_("Cannot export audio to %s"),
path));
AudacityMessageBox( XO("Cannot export audio to %s").Format( path ) );
process.Detach();
process.CloseOutput();

View File

@ -63,7 +63,8 @@ static bool CheckFFmpegPresence(bool quiet = false)
{
if (!quiet)
{
AudacityMessageBox(_("Properly configured FFmpeg is required to proceed.\nYou can configure it at Preferences > Libraries."));
AudacityMessageBox(XO(
"Properly configured FFmpeg is required to proceed.\nYou can configure it at Preferences > Libraries."));
}
result = false;
}
@ -283,8 +284,12 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, const T
const auto path = mName.GetFullPath();
if ((mEncFormatDesc = av_guess_format(shortname, OSINPUT(path), NULL)) == NULL)
{
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Can't determine format description for file \"%s\"."), path),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
AudacityMessageBox(
XO(
"FFmpeg : ERROR - Can't determine format description for file \"%s\".")
.Format( path ),
XO("FFmpeg Error"),
wxOK|wxCENTER|wxICON_EXCLAMATION );
return false;
}
@ -292,8 +297,10 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, const T
mEncFormatCtx.reset(avformat_alloc_context());
if (!mEncFormatCtx)
{
AudacityMessageBox(_("FFmpeg : ERROR - Can't allocate output format context."),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
AudacityMessageBox(
XO("FFmpeg : ERROR - Can't allocate output format context."),
XO("FFmpeg Error"),
wxOK|wxCENTER|wxICON_EXCLAMATION);
return false;
}
@ -305,8 +312,11 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, const T
// At the moment Audacity can export only one audio stream
if ((mEncAudioStream = avformat_new_stream(mEncFormatCtx.get(), NULL)) == NULL)
{
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Can't add audio stream to output file \"%s\"."), path),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
AudacityMessageBox(
XO("FFmpeg : ERROR - Can't add audio stream to output file \"%s\".")
.Format( path ),
XO("FFmpeg Error"),
wxOK|wxCENTER|wxICON_EXCLAMATION);
return false;
}
@ -330,8 +340,11 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, const T
{
if ((err = ufile_fopen(&mEncFormatCtx->pb, path, AVIO_FLAG_WRITE)) < 0)
{
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Can't open output file \"%s\" to write. Error code is %d."), path, err),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
AudacityMessageBox(
XO("FFmpeg : ERROR - Can't open output file \"%s\" to write. Error code is %d.")
.Format( path, err ),
XO("FFmpeg Error"),
wxOK|wxCENTER|wxICON_EXCLAMATION);
return false;
}
// Give mUfileCloser responsibility
@ -356,8 +369,11 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, const T
// Write headers to the output file.
if ((err = avformat_write_header(mEncFormatCtx.get(), NULL)) < 0)
{
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Can't write headers to output file \"%s\". Error code is %d."), path, err),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
AudacityMessageBox(
XO("FFmpeg : ERROR - Can't write headers to output file \"%s\". Error code is %d.")
.Format( path, err ),
XO("FFmpeg Error"),
wxOK|wxCENTER|wxICON_EXCLAMATION);
return false;
}
@ -502,9 +518,13 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
// Is the required audio codec compiled into libavcodec?
if (codec == NULL)
{
/* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
AudacityMessageBox(wxString::Format(_("FFmpeg cannot find audio codec 0x%x.\nSupport for this codec is probably not compiled in."), (unsigned int) mEncAudioCodecCtx->codec_id),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
AudacityMessageBox(
XO(
/* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
"FFmpeg cannot find audio codec 0x%x.\nSupport for this codec is probably not compiled in.")
.Format( (unsigned int) mEncAudioCodecCtx->codec_id ),
XO("FFmpeg Error"),
wxOK|wxCENTER|wxICON_EXCLAMATION);
return false;
}
@ -536,9 +556,12 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
// Open the codec.
if (avcodec_open2(mEncAudioCodecCtx.get(), codec, &options) < 0)
{
/* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Can't open audio codec 0x%x."),mEncAudioCodecCtx->codec_id),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
AudacityMessageBox(
/* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
XO("FFmpeg : ERROR - Can't open audio codec 0x%x.")
.Format( mEncAudioCodecCtx->codec_id ),
XO("FFmpeg Error"),
wxOK|wxCENTER|wxICON_EXCLAMATION);
return false;
}
@ -559,8 +582,9 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
if (!mEncAudioFifoOutBuf)
{
AudacityMessageBox(
_("FFmpeg : ERROR - Can't allocate buffer to read into from audio FIFO."),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
XO("FFmpeg : ERROR - Can't allocate buffer to read into from audio FIFO."),
XO("FFmpeg Error"),
wxOK|wxCENTER|wxICON_EXCLAMATION
);
return false;
}
@ -592,16 +616,18 @@ static int encode_audio(AVCodecContext *avctx, AVPacket *pkt, int16_t *audio_sam
avctx->sample_fmt, 0);
if (buffer_size < 0) {
AudacityMessageBox(
_("FFmpeg : ERROR - Could not get sample buffer size"),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
XO("FFmpeg : ERROR - Could not get sample buffer size"),
XO("FFmpeg Error"),
wxOK|wxCENTER|wxICON_EXCLAMATION
);
return buffer_size;
}
samples.reset(static_cast<uint8_t*>(av_malloc(buffer_size)));
if (!samples) {
AudacityMessageBox(
_("FFmpeg : ERROR - Could not allocate bytes for samples buffer"),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
XO("FFmpeg : ERROR - Could not allocate bytes for samples buffer"),
XO("FFmpeg Error"),
wxOK|wxCENTER|wxICON_EXCLAMATION
);
return AVERROR(ENOMEM);
}
@ -610,8 +636,9 @@ static int encode_audio(AVCodecContext *avctx, AVPacket *pkt, int16_t *audio_sam
samples.get(), buffer_size, 0);
if (ret < 0) {
AudacityMessageBox(
_("FFmpeg : ERROR - Could not setup audio frame"),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
XO("FFmpeg : ERROR - Could not setup audio frame"),
XO("FFmpeg Error"),
wxOK|wxCENTER|wxICON_EXCLAMATION
);
return ret;
}
@ -660,8 +687,9 @@ static int encode_audio(AVCodecContext *avctx, AVPacket *pkt, int16_t *audio_sam
ret = avcodec_encode_audio2(avctx, pkt, frame.get(), &got_output);
if (ret < 0) {
AudacityMessageBox(
_("FFmpeg : ERROR - encoding frame failed"),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
XO("FFmpeg : ERROR - encoding frame failed"),
XO("FFmpeg Error"),
wxOK|wxCENTER|wxICON_EXCLAMATION
);
return ret;
}
@ -689,8 +717,9 @@ bool ExportFFmpeg::Finalize()
if (nAudioFrameSizeOut > mEncAudioFifoOutBufSiz || nFifoBytes > mEncAudioFifoOutBufSiz) {
AudacityMessageBox(
_("FFmpeg : ERROR - Too much remaining data."),
_("FFmpeg Error"), wxOK | wxCENTER | wxICON_EXCLAMATION
XO("FFmpeg : ERROR - Too much remaining data."),
XO("FFmpeg Error"),
wxOK | wxCENTER | wxICON_EXCLAMATION
);
return false;
}
@ -721,7 +750,7 @@ bool ExportFFmpeg::Finalize()
{
wxLogDebug(wxT("FFmpeg : Reading from Audio FIFO failed, aborting"));
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return false;
}
}
@ -733,7 +762,7 @@ bool ExportFFmpeg::Finalize()
if (encodeResult < 0) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return false;
}
else if (encodeResult == 0)
@ -753,8 +782,9 @@ bool ExportFFmpeg::Finalize()
if (av_interleaved_write_frame(mEncFormatCtx.get(), &pkt) != 0)
{
AudacityMessageBox(
_("FFmpeg : ERROR - Couldn't write last audio frame to output file."),
_("FFmpeg Error"), wxOK | wxCENTER | wxICON_EXCLAMATION
XO("FFmpeg : ERROR - Couldn't write last audio frame to output file."),
XO("FFmpeg Error"),
wxOK | wxCENTER | wxICON_EXCLAMATION
);
return false;
}
@ -763,7 +793,7 @@ bool ExportFFmpeg::Finalize()
// Write any file trailers.
if (av_write_trailer(mEncFormatCtx.get()) != 0) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return false;
}
@ -809,8 +839,9 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
if (nAudioFrameSizeOut > mEncAudioFifoOutBufSiz) {
AudacityMessageBox(
_("FFmpeg : ERROR - nAudioFrameSizeOut too large."),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
XO("FFmpeg : ERROR - nAudioFrameSizeOut too large."),
XO("FFmpeg Error"),
wxOK|wxCENTER|wxICON_EXCLAMATION
);
return false;
}
@ -829,8 +860,9 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
if (ret < 0)
{
AudacityMessageBox(
_("FFmpeg : ERROR - Can't encode audio frame."),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
XO("FFmpeg : ERROR - Can't encode audio frame."),
XO("FFmpeg Error"),
wxOK|wxCENTER|wxICON_EXCLAMATION
);
return false;
}
@ -850,8 +882,9 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
if ((ret = av_interleaved_write_frame(mEncFormatCtx.get(), &pkt)) < 0)
{
AudacityMessageBox(
_("FFmpeg : ERROR - Failed to write audio frame to file."),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
XO("FFmpeg : ERROR - Failed to write audio frame to file."),
XO("FFmpeg Error"),
wxOK|wxCENTER|wxICON_EXCLAMATION
);
return false;
}
@ -874,11 +907,12 @@ ProgressResult ExportFFmpeg::Export(AudacityProject *project,
if (channels > ExportFFmpegOptions::fmts[mSubFormat].maxchannels)
{
AudacityMessageBox(
wxString::Format(
_("Attempted to export %d channels, but maximum number of channels for selected output format is %d"),
XO(
"Attempted to export %d channels, but maximum number of channels for selected output format is %d")
.Format(
channels,
ExportFFmpegOptions::fmts[mSubFormat].maxchannels),
_("Error"));
ExportFFmpegOptions::fmts[mSubFormat].maxchannels ),
XO("Error"));
return ProgressResult::Cancelled;
}
mName = fName;
@ -887,7 +921,7 @@ ProgressResult ExportFFmpeg::Export(AudacityProject *project,
if (mSubFormat >= FMT_LAST) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
@ -899,7 +933,7 @@ ProgressResult ExportFFmpeg::Export(AudacityProject *project,
if (!ret) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
@ -932,7 +966,7 @@ ProgressResult ExportFFmpeg::Export(AudacityProject *project,
pcmBuffer, (pcmNumSamples)*sizeof(int16_t)*mChannels)) {
// TODO: more precise message, and fix redundancy with messages
// already given on some of the failure paths of the above call
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
updateResult = ProgressResult::Cancelled;
break;
}
@ -947,7 +981,7 @@ ProgressResult ExportFFmpeg::Export(AudacityProject *project,
if ( mUfileCloser.close() != 0 ) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}

View File

@ -677,8 +677,11 @@ bool FFmpegPresets::OverwriteIsOk( wxString &name )
FFmpegPreset *preset = FindPreset(name);
if (preset)
{
wxString query = wxString::Format(_("Overwrite preset '%s'?"),name);
int action = AudacityMessageBox(query,_("Confirm Overwrite"),wxYES_NO | wxCENTRE);
auto query = XO("Overwrite preset '%s'?").Format(name);
int action = AudacityMessageBox(
query,
XO("Confirm Overwrite"),
wxYES_NO | wxCENTRE);
if (action == wxNO) return false;
}
return true;
@ -699,7 +702,7 @@ bool FFmpegPresets::SavePreset(ExportFFmpegOptions *parent, wxString &name)
lb = dynamic_cast<wxListBox*>(wnd);
if (lb->GetSelection() < 0)
{
AudacityMessageBox(_("Please select format before saving a profile"));
AudacityMessageBox( XO("Please select format before saving a profile") );
return false;
}
format = lb->GetStringSelection();
@ -709,7 +712,7 @@ bool FFmpegPresets::SavePreset(ExportFFmpegOptions *parent, wxString &name)
if (lb->GetSelection() < 0)
{
/* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
AudacityMessageBox(_("Please select codec before saving a profile"));
AudacityMessageBox( XO("Please select codec before saving a profile") );
return false;
}
codec = lb->GetStringSelection();
@ -784,7 +787,7 @@ void FFmpegPresets::LoadPreset(ExportFFmpegOptions *parent, wxString &name)
FFmpegPreset *preset = FindPreset(name);
if (!preset)
{
AudacityMessageBox(wxString::Format(_("Preset '%s' does not exist."),name));
AudacityMessageBox( XO("Preset '%s' does not exist." ).Format(name));
return;
}
@ -885,8 +888,11 @@ bool FFmpegPresets::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
mPreset = FindPreset(value);
if (mPreset)
{
wxString query = wxString::Format(_("Replace preset '%s'?"), value);
int action = AudacityMessageBox(query, _("Confirm Overwrite"), wxYES_NO | wxCANCEL | wxCENTRE);
auto query = XO("Replace preset '%s'?").Format( value );
int action = AudacityMessageBox(
query,
XO("Confirm Overwrite"),
wxYES_NO | wxCANCEL | wxCENTRE);
if (action == wxCANCEL)
{
mAbortImport = true;
@ -1910,12 +1916,15 @@ void ExportFFmpegOptions::OnDeletePreset(wxCommandEvent& WXUNUSED(event))
wxString presetname = preset->GetValue();
if (presetname.empty())
{
AudacityMessageBox(_("You can't delete a preset without name"));
AudacityMessageBox( XO("You can't delete a preset without name") );
return;
}
wxString query = wxString::Format(_("Delete preset '%s'?"),presetname);
int action = AudacityMessageBox(query,_("Confirm Deletion"),wxYES_NO | wxCENTRE);
auto query = XO("Delete preset '%s'?").Format( presetname );
int action = AudacityMessageBox(
query,
XO("Confirm Deletion"),
wxYES_NO | wxCENTRE);
if (action == wxNO) return;
mPresets->DeletePreset(presetname);
@ -1941,7 +1950,7 @@ bool ExportFFmpegOptions::SavePreset(bool bCheckForOverwrite)
wxString name = preset->GetValue();
if (name.empty())
{
AudacityMessageBox(_("You can't save a preset without a name"));
AudacityMessageBox( XO("You can't save a preset without a name") );
return false;
}
if( bCheckForOverwrite && !mPresets->OverwriteIsOk(name))
@ -2015,7 +2024,7 @@ void ExportFFmpegOptions::OnExportPresets(wxCommandEvent& WXUNUSED(event))
mPresets->GetPresetList( presets);
if( presets.Count() < 1)
{
AudacityMessageBox(_("No presets to export"));
AudacityMessageBox( XO("No presets to export") );
return;
}
@ -2103,11 +2112,10 @@ bool ExportFFmpegOptions::ReportIfBadCombination()
AudacityMessageBox(
/* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
wxString::Format(_("Format %s is not compatible with codec %s."),
*selfmt,
*selcdc ),
XO("Format %s is not compatible with codec %s.")
.Format( *selfmt, *selcdc ),
/* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
_("Incompatible format and codec"));
XO("Incompatible format and codec"));
return true;
}

View File

@ -283,7 +283,7 @@ ProgressResult ExportFLAC::Export(AudacityProject *project,
// See note in GetMetadata() about a bug in libflac++ 1.1.2
if (success && !GetMetadata(project, metadata)) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
@ -336,7 +336,7 @@ ProgressResult ExportFLAC::Export(AudacityProject *project,
if (!success) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
@ -346,7 +346,7 @@ ProgressResult ExportFLAC::Export(AudacityProject *project,
wxFFile f; // will be closed when it goes out of scope
const auto path = fName.GetFullPath();
if (!f.Open(path, wxT("w+b"))) {
AudacityMessageBox(wxString::Format(_("FLAC export couldn't open %s"), path));
AudacityMessageBox( XO("FLAC export couldn't open %s").Format( path ) );
return ProgressResult::Cancelled;
}
@ -355,7 +355,9 @@ ProgressResult ExportFLAC::Export(AudacityProject *project,
// libflac can't (under Windows).
int status = encoder.init(f.fp());
if (status != FLAC__STREAM_ENCODER_INIT_STATUS_OK) {
AudacityMessageBox(wxString::Format(_("FLAC encoder failed to initialize\nStatus: %d"), status));
AudacityMessageBox(
XO("FLAC encoder failed to initialize\nStatus: %d")
.Format( status ) );
return ProgressResult::Cancelled;
}
#endif
@ -408,7 +410,7 @@ ProgressResult ExportFLAC::Export(AudacityProject *project,
reinterpret_cast<FLAC__int32**>( tmpsmplbuf.get() ),
samplesThisRun) ) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
updateResult = ProgressResult::Cancelled;
break;
}

View File

@ -264,8 +264,10 @@ ProgressResult ExportMP2::Export(AudacityProject *project,
if (twolame_init_params(encodeOptions) != 0)
{
AudacityMessageBox(_("Cannot export MP2 with this sample rate and bit rate"),
_("Error"), wxICON_STOP);
AudacityMessageBox(
XO("Cannot export MP2 with this sample rate and bit rate"),
XO("Error"),
wxICON_STOP);
return ProgressResult::Cancelled;
}
@ -275,7 +277,7 @@ ProgressResult ExportMP2::Export(AudacityProject *project,
FileIO outFile(fName, FileIO::Output);
if (!outFile.IsOpened()) {
AudacityMessageBox(_("Unable to open target file for writing"));
AudacityMessageBox( XO("Unable to open target file for writing") );
return ProgressResult::Cancelled;
}
@ -286,7 +288,7 @@ ProgressResult ExportMP2::Export(AudacityProject *project,
if (id3len && !endOfFile) {
if ( outFile.Write(id3buffer.get(), id3len).GetLastError() ) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
}
@ -332,14 +334,14 @@ ProgressResult ExportMP2::Export(AudacityProject *project,
if (mp2BufferNumBytes < 0) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
updateResult = ProgressResult::Cancelled;
break;
}
if ( outFile.Write(mp2Buffer.get(), mp2BufferNumBytes).GetLastError() ) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
@ -355,7 +357,7 @@ ProgressResult ExportMP2::Export(AudacityProject *project,
if (mp2BufferNumBytes > 0)
if ( outFile.Write(mp2Buffer.get(), mp2BufferNumBytes).GetLastError() ) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
@ -364,13 +366,13 @@ ProgressResult ExportMP2::Export(AudacityProject *project,
if (id3len && endOfFile)
if ( outFile.Write(id3buffer.get(), id3len).GetLastError() ) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
if ( !outFile.Close() ) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}

View File

@ -831,7 +831,7 @@ private:
#endif // DISABLE_DYNAMIC_LOADING_LAME
#if defined(__WXMSW__)
wxString mBladeVersion;
TranslatableString mBladeVersion;
#endif
bool mEncoding;
@ -969,7 +969,7 @@ bool MP3Exporter::LoadLibrary(wxWindow *parent, AskUser askuser)
}
#if defined(__WXMSW__)
mBladeVersion.Empty();
mBladeVersion = {};
#endif
if( !mLibIsExternal ){
@ -1010,7 +1010,7 @@ bool MP3Exporter::LoadLibrary(wxWindow *parent, AskUser askuser)
if (!ValidLibraryLoaded()) {
#if defined(__WXMSW__)
if (askuser && !mBladeVersion.empty()) {
AudacityMessageBox(mBladeVersion);
AudacityMessageBox( mBladeVersion );
}
#endif
wxLogMessage(wxT("Failed to locate LAME library"));
@ -1205,12 +1205,14 @@ bool MP3Exporter::InitLibraryExternal(wxString libpath)
be_version v;
beVersion(&v);
mBladeVersion.Printf(_("You are linking to lame_enc.dll v%d.%d. This version is not compatible with Audacity %d.%d.%d.\nPlease download the latest version of 'LAME for Audacity'."),
v.byMajorVersion,
v.byMinorVersion,
AUDACITY_VERSION,
AUDACITY_RELEASE,
AUDACITY_REVISION);
mBladeVersion = XO(
"You are linking to lame_enc.dll v%d.%d. This version is not compatible with Audacity %d.%d.%d.\nPlease download the latest version of 'LAME for Audacity'.")
.Format(
v.byMajorVersion,
v.byMinorVersion,
AUDACITY_VERSION,
AUDACITY_RELEASE,
AUDACITY_REVISION);
}
#endif
@ -1694,7 +1696,7 @@ bool ExportMP3::CheckFileName(wxFileName & WXUNUSED(filename), int WXUNUSED(form
MP3Exporter exporter;
if (!exporter.LoadLibrary(wxTheApp->GetTopWindow(), MP3Exporter::Maybe)) {
AudacityMessageBox(_("Could not open MP3 encoding library!"));
AudacityMessageBox( XO("Could not open MP3 encoding library!") );
gPrefs->Write(wxT("/MP3/MP3LibPath"), wxString(wxT("")));
gPrefs->Flush();
@ -1734,7 +1736,7 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
#ifdef DISABLE_DYNAMIC_LOADING_LAME
if (!exporter.InitLibrary(wxT(""))) {
AudacityMessageBox(_("Could not initialize MP3 encoding library!"));
AudacityMessageBox( _("Could not initialize MP3 encoding library!") );
gPrefs->Write(wxT("/MP3/MP3LibPath"), wxString(wxT("")));
gPrefs->Flush();
@ -1742,7 +1744,7 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
}
#else
if (!exporter.LoadLibrary(parent, MP3Exporter::Maybe)) {
AudacityMessageBox(_("Could not open MP3 encoding library!"));
AudacityMessageBox( XO("Could not open MP3 encoding library!") );
gPrefs->Write(wxT("/MP3/MP3LibPath"), wxString(wxT("")));
gPrefs->Flush();
@ -1750,7 +1752,7 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
}
if (!exporter.ValidLibraryLoaded()) {
AudacityMessageBox(_("Not a valid or supported MP3 encoding library!"));
AudacityMessageBox( XO("Not a valid or supported MP3 encoding library!") );
gPrefs->Write(wxT("/MP3/MP3LibPath"), wxString(wxT("")));
gPrefs->Flush();
@ -1832,7 +1834,7 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
auto inSamples = exporter.InitializeStream(channels, rate);
if (((int)inSamples) < 0) {
AudacityMessageBox(_("Unable to initialize MP3 stream"));
AudacityMessageBox( XO("Unable to initialize MP3 stream") );
return ProgressResult::Cancelled;
}
@ -1843,7 +1845,7 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
// Open file for writing
wxFFile outFile(fName.GetFullPath(), wxT("w+b"));
if (!outFile.IsOpened()) {
AudacityMessageBox(_("Unable to open target file for writing"));
AudacityMessageBox( XO("Unable to open target file for writing") );
return ProgressResult::Cancelled;
}
@ -1853,7 +1855,7 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
if (id3len && !endOfFile) {
if (id3len > outFile.Write(id3buffer.get(), id3len)) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
}
@ -1865,7 +1867,7 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
size_t bufferSize = std::max(0, exporter.GetOutBufferSize());
if (bufferSize <= 0) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
@ -1928,16 +1930,16 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
}
if (bytes < 0) {
wxString msg;
msg.Printf(_("Error %ld returned from MP3 encoder"), bytes);
AudacityMessageBox(msg);
auto msg = XO("Error %ld returned from MP3 encoder")
.Format( bytes );
AudacityMessageBox( msg );
updateResult = ProgressResult::Cancelled;
break;
}
if (bytes > (int)outFile.Write(buffer.get(), bytes)) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
updateResult = ProgressResult::Cancelled;
break;
}
@ -1952,14 +1954,14 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
if (bytes < 0) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
if (bytes > 0) {
if (bytes > (int)outFile.Write(buffer.get(), bytes)) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
}
@ -1968,7 +1970,7 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
if (id3len > 0 && endOfFile) {
if (bytes > (int)outFile.Write(id3buffer.get(), id3len)) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
}
@ -1983,7 +1985,7 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
!outFile.Flush() ||
!outFile.Close()) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
}

View File

@ -184,19 +184,23 @@ int ExportMultipleDialog::ShowModal()
// Cannot export if all audio tracks are muted.
if (mNumWaveTracks == 0)
{
::AudacityMessageBox(_("All audio is muted."),
_("Cannot Export Multiple"),
wxOK | wxCENTRE, this);
::AudacityMessageBox(
XO("All audio is muted."),
XO("Cannot Export Multiple"),
wxOK | wxCENTRE,
this);
return wxID_CANCEL;
}
if ((mNumWaveTracks < 1) && (mNumLabels < 1))
{
::AudacityMessageBox(_(
::AudacityMessageBox(
XO(
"You have no unmuted Audio Tracks and no applicable \
\nlabels, so you cannot export to separate audio files."),
_("Cannot Export Multiple"),
wxOK | wxCENTRE, this);
XO("Cannot Export Multiple"),
wxOK | wxCENTRE,
this);
return wxID_CANCEL;
}
@ -500,10 +504,11 @@ void ExportMultipleDialog::OnCreate(wxCommandEvent& WXUNUSED(event))
return;
}
::AudacityMessageBox(wxString::Format(_("\"%s\" successfully created."),
fn.GetPath()),
_("Export Multiple"),
wxOK | wxCENTRE, this);
::AudacityMessageBox(
XO("\"%s\" successfully created.").Format( fn.GetPath() ),
XO("Export Multiple"),
wxOK | wxCENTRE,
this);
}
void ExportMultipleDialog::OnChoose(wxCommandEvent& WXUNUSED(event))
@ -657,14 +662,13 @@ bool ExportMultipleDialog::DirOk()
return true;
}
wxString prompt;
auto prompt = XO("\"%s\" doesn't exist.\n\nWould you like to create it?")
.Format( fn.GetFullPath() );
prompt.Printf(_("\"%s\" doesn't exist.\n\nWould you like to create it?"),
fn.GetFullPath());
int action = AudacityMessageBox(prompt,
wxT("Warning"),
wxYES_NO | wxICON_EXCLAMATION);
int action = AudacityMessageBox(
prompt,
XO("Warning"),
wxYES_NO | wxICON_EXCLAMATION);
if (action != wxYES) {
return false;
}

View File

@ -182,7 +182,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
FileIO outFile(fName, FileIO::Output);
if (!outFile.IsOpened()) {
AudacityMessageBox(_("Unable to open target file for writing"));
AudacityMessageBox( XO("Unable to open target file for writing") );
return ProgressResult::Cancelled;
}
@ -209,7 +209,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
vorbis_info_init(&info);
if (vorbis_encode_init_vbr(&info, numChannels, (int)(rate + 0.5), quality)) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export - rate or quality problem"));
AudacityMessageBox( XO("Unable to export - rate or quality problem") );
return ProgressResult::Cancelled;
}
@ -223,14 +223,14 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
// Retrieve tags
if (!FillComment(project, &comment, metadata)) {
AudacityMessageBox(_("Unable to export - problem with metadata"));
AudacityMessageBox( XO("Unable to export - problem with metadata") );
return ProgressResult::Cancelled;
}
// Set up analysis state and auxiliary encoding storage
if (vorbis_analysis_init(&dsp, &info) ||
vorbis_block_init(&dsp, &block)) {
AudacityMessageBox(_("Unable to export - problem initialising"));
AudacityMessageBox( XO("Unable to export - problem initialising") );
return ProgressResult::Cancelled;
}
@ -239,7 +239,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
// chained streams with concatenation.
srand(time(NULL));
if (ogg_stream_init(&stream, rand())) {
AudacityMessageBox(_("Unable to export - problem creating stream"));
AudacityMessageBox( XO("Unable to export - problem creating stream") );
return ProgressResult::Cancelled;
}
@ -261,7 +261,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
ogg_stream_packetin(&stream, &bitstream_header) ||
ogg_stream_packetin(&stream, &comment_header) ||
ogg_stream_packetin(&stream, &codebook_header)) {
AudacityMessageBox(_("Unable to export - problem with packets"));
AudacityMessageBox( XO("Unable to export - problem with packets") );
return ProgressResult::Cancelled;
}
@ -270,7 +270,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
while (ogg_stream_flush(&stream, &page)) {
if ( outFile.Write(page.header, page.header_len).GetLastError() ||
outFile.Write(page.body, page.body_len).GetLastError()) {
AudacityMessageBox(_("Unable to export - problem with file"));
AudacityMessageBox( XO("Unable to export - problem with file") );
return ProgressResult::Cancelled;
}
}
@ -338,7 +338,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
if ( outFile.Write(page.header, page.header_len).GetLastError() ||
outFile.Write(page.body, page.body_len).GetLastError()) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
@ -352,7 +352,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
if (err) {
updateResult = ProgressResult::Cancelled;
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
break;
}
@ -363,7 +363,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
if ( !outFile.Close() ) {
updateResult = ProgressResult::Cancelled;
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
}
return updateResult;

View File

@ -476,12 +476,13 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
// Bug 46. Trap here, as sndfile.c does not trap it properly.
if( (numChannels != 1) && ((sf_format & SF_FORMAT_SUBMASK) == SF_FORMAT_GSM610) )
{
AudacityMessageBox(_("GSM 6.10 requires mono"));
AudacityMessageBox( XO("GSM 6.10 requires mono") );
return ProgressResult::Cancelled;
}
if( sf_format == SF_FORMAT_WAVEX + SF_FORMAT_GSM610){
AudacityMessageBox( _("WAVEX and GSM 6.10 formats are not compatible") );
AudacityMessageBox(
XO("WAVEX and GSM 6.10 formats are not compatible") );
return ProgressResult::Cancelled;
}
@ -490,7 +491,7 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
if (!sf_format_check(&info))
info.format = (info.format & SF_FORMAT_TYPEMASK);
if (!sf_format_check(&info)) {
AudacityMessageBox(_("Cannot export audio in this format."));
AudacityMessageBox( XO("Cannot export audio in this format.") );
return ProgressResult::Cancelled;
}
@ -505,8 +506,7 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
}
if (!sf) {
AudacityMessageBox(wxString::Format(_("Cannot export audio to %s"),
path));
AudacityMessageBox( XO("Cannot export audio to %s").Format( path ) );
return ProgressResult::Cancelled;
}
// Retrieve tags if not given a set
@ -577,13 +577,13 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
if (static_cast<size_t>(samplesWritten) != numSamples) {
char buffer2[1000];
sf_error_str(sf.get(), buffer2, 1000);
AudacityMessageBox(wxString::Format(
/* i18n-hint: %s will be the error message from libsndfile, which
* is usually something unhelpful (and untranslated) like "system
* error" */
_("Error while writing %s file (disk full?).\nLibsndfile says \"%s\""),
formatStr,
wxString::FromAscii(buffer2)));
AudacityMessageBox(
XO(
/* i18n-hint: %s will be the error message from libsndfile, which
* is usually something unhelpful (and untranslated) like "system
* error" */
"Error while writing %s file (disk full?).\nLibsndfile says \"%s\"")
.Format( formatStr, wxString::FromAscii(buffer2) ));
updateResult = ProgressResult::Cancelled;
break;
}
@ -599,13 +599,13 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
fileFormat == SF_FORMAT_WAVEX) {
if (!AddStrings(project, sf.get(), metadata, sf_format)) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
}
if (0 != sf.close()) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}
}
@ -618,7 +618,7 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
// Note: file has closed, and gets reopened and closed again here:
if (!AddID3Chunk(fName, metadata, sf_format) ) {
// TODO: more precise message
AudacityMessageBox(_("Unable to export"));
AudacityMessageBox( XO("Unable to export") );
return ProgressResult::Cancelled;
}

View File

@ -942,8 +942,9 @@ GStreamerImportFileHandle::Init()
// Add the decoder to the pipeline
if (!gst_bin_add(GST_BIN(mPipeline.get()), mDec))
{
AudacityMessageBox(_("Unable to add decoder to pipeline"),
_("GStreamer Importer"));
AudacityMessageBox(
XO("Unable to add decoder to pipeline"),
XO("GStreamer Importer"));
// Cleanup expected to occur in destructor
return false;
@ -953,8 +954,9 @@ GStreamerImportFileHandle::Init()
GstStateChangeReturn state = gst_element_set_state(mPipeline.get(), GST_STATE_PAUSED);
if (state == GST_STATE_CHANGE_FAILURE)
{
AudacityMessageBox(_("Unable to set stream state to paused."),
_("GStreamer Importer"));
AudacityMessageBox(
XO("Unable to set stream state to paused."),
XO("GStreamer Importer"));
return false;
}
@ -1082,8 +1084,9 @@ GStreamerImportFileHandle::Import(TrackFactory *trackFactory,
// Can't do much if we don't have any streams to process
if (!haveStreams)
{
AudacityMessageBox(_("File doesn't contain any audio streams."),
_("GStreamer Importer"));
AudacityMessageBox(
XO("File doesn't contain any audio streams."),
XO("GStreamer Importer"));
return ProgressResult::Failed;
}
@ -1091,8 +1094,9 @@ GStreamerImportFileHandle::Import(TrackFactory *trackFactory,
GstStateChangeReturn state = gst_element_set_state(mPipeline.get(), GST_STATE_PLAYING);
if (state == GST_STATE_CHANGE_FAILURE)
{
AudacityMessageBox(_("Unable to import file, state change failed."),
_("GStreamer Importer"));
AudacityMessageBox(
XO("Unable to import file, state change failed."),
XO("GStreamer Importer"));
return ProgressResult::Failed;
}
@ -1210,10 +1214,11 @@ GStreamerImportFileHandle::ProcessBusMessage(bool & success)
wxString::FromUTF8(err.get()->message),
debug ? wxT("\n") : wxT(""),
debug ? wxString::FromUTF8(debug.get()) : wxT(""));
auto msg = XO("GStreamer Error: %s").Format( m );
#if defined(_DEBUG)
AudacityMessageBox(wxString::Format(_("GStreamer Error: %s"), m));
AudacityMessageBox( msg );
#else
wxLogMessage(wxT("GStreamer Error: %s"), m);
wxLogMessage( msg.Debug() );
#endif
}

View File

@ -344,9 +344,11 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln)
else
{
/* i18n-hint: You do not need to translate "LOF" */
AudacityMessageBox(_("Invalid window offset in LOF file."),
/* i18n-hint: You do not need to translate "LOF" */
_("LOF Error"), wxOK | wxCENTRE);
AudacityMessageBox(
XO("Invalid window offset in LOF file."),
/* i18n-hint: You do not need to translate "LOF" */
XO("LOF Error"),
wxOK | wxCENTRE);
}
if (tok.HasMoreTokens())
@ -365,9 +367,11 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln)
else
{
/* i18n-hint: You do not need to translate "LOF" */
AudacityMessageBox(_("Invalid duration in LOF file."),
/* i18n-hint: You do not need to translate "LOF" */
_("LOF Error"), wxOK | wxCENTRE);
AudacityMessageBox(
XO("Invalid duration in LOF file."),
/* i18n-hint: You do not need to translate "LOF" */
XO("LOF Error"),
wxOK | wxCENTRE);
}
} // End if statement
@ -457,8 +461,10 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln)
if (targetfile.AfterLast(wxT('.')).IsSameAs(wxT("mid"), false) ||
targetfile.AfterLast(wxT('.')).IsSameAs(wxT("midi"), false))
{
AudacityMessageBox(_("MIDI tracks cannot be offset individually, only audio files can be."),
_("LOF Error"), wxOK | wxCENTRE);
AudacityMessageBox(
XO("MIDI tracks cannot be offset individually, only audio files can be."),
XO("LOF Error"),
wxOK | wxCENTRE);
}
else
#endif
@ -473,8 +479,10 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln)
else
{
/* i18n-hint: You do not need to translate "LOF" */
AudacityMessageBox(_("Invalid track offset in LOF file."),
_("LOF Error"), wxOK | wxCENTRE);
AudacityMessageBox(
XO("Invalid track offset in LOF file."),
XO("LOF Error"),
wxOK | wxCENTRE);
}
} // End if statement for "offset" parameters
} // End if statement (more tokens after file name)

View File

@ -59,9 +59,8 @@ bool DoImportMIDI( AudacityProject &project, const FilePath &fileName )
bool ImportMIDI(const FilePath &fName, NoteTrack * dest)
{
if (fName.length() <= 4){
AudacityMessageBox( wxString::Format(
_("Could not open file %s: Filename too short."), fName
) );
AudacityMessageBox(
XO("Could not open file %s: Filename too short.").Format( fName ) );
return false;
}
@ -69,17 +68,15 @@ bool ImportMIDI(const FilePath &fName, NoteTrack * dest)
if (fName.Right(4).CmpNoCase(wxT(".mid")) == 0 || fName.Right(5).CmpNoCase(wxT(".midi")) == 0)
is_midi = true;
else if(fName.Right(4).CmpNoCase(wxT(".gro")) != 0) {
AudacityMessageBox( wxString::Format(
_("Could not open file %s: Incorrect filetype."), fName
) );
AudacityMessageBox(
XO("Could not open file %s: Incorrect filetype.").Format( fName ) );
return false;
}
wxFFile mf(fName, wxT("rb"));
if (!mf.IsOpened()) {
AudacityMessageBox( wxString::Format(
_("Could not open file %s."), fName
) );
AudacityMessageBox(
XO("Could not open file %s.").Format( fName ) );
return false;
}
@ -88,9 +85,8 @@ bool ImportMIDI(const FilePath &fName, NoteTrack * dest)
//Should we also check if(seq->tracks() == 0) ?
if(new_seq->get_read_error() == alg_error_open){
AudacityMessageBox( wxString::Format(
_("Could not open file %s."), fName
) );
AudacityMessageBox(
XO("Could not open file %s.").Format( fName ) );
mf.Close();
return false;
}

View File

@ -270,7 +270,7 @@ ProgressResult QTImportFileHandle::Import(TrackFactory *trackFactory,
{
err = MovieAudioExtractionBegin(mMovie, 0, &maer);
if (err != noErr) {
AudacityMessageBox(_("Unable to start QuickTime extraction"));
AudacityMessageBox( XO("Unable to start QuickTime extraction") );
break;
}
@ -280,7 +280,7 @@ ProgressResult QTImportFileHandle::Import(TrackFactory *trackFactory,
sizeof(quality),
&quality);
if (err != noErr) {
AudacityMessageBox(_("Unable to set QuickTime render quality"));
AudacityMessageBox( XO("Unable to set QuickTime render quality") );
break;
}
@ -290,7 +290,8 @@ ProgressResult QTImportFileHandle::Import(TrackFactory *trackFactory,
sizeof(discrete),
&discrete);
if (err != noErr) {
AudacityMessageBox(_("Unable to set QuickTime discrete channels property"));
AudacityMessageBox( XO(
"Unable to set QuickTime discrete channels property") );
break;
}
@ -301,7 +302,8 @@ ProgressResult QTImportFileHandle::Import(TrackFactory *trackFactory,
&maxSampleSize,
NULL);
if (err != noErr) {
AudacityMessageBox(_("Unable to get QuickTime sample size property"));
AudacityMessageBox( XO(
"Unable to get QuickTime sample size property") );
break;
}
@ -312,7 +314,7 @@ ProgressResult QTImportFileHandle::Import(TrackFactory *trackFactory,
&desc,
NULL);
if (err != noErr) {
AudacityMessageBox(_("Unable to retrieve stream description"));
AudacityMessageBox( XO("Unable to retrieve stream description") );
break;
}
@ -371,7 +373,7 @@ ProgressResult QTImportFileHandle::Import(TrackFactory *trackFactory,
abl.get(),
&flags);
if (err != noErr) {
AudacityMessageBox(_("Unable to get fill buffer"));
AudacityMessageBox( XO("Unable to get fill buffer") );
break;
}

View File

@ -181,7 +181,7 @@ void OnUndo(const CommandContext &context)
auto &window = ProjectWindow::Get( project );
if (!ProjectHistory::Get( project ).UndoAvailable()) {
AudacityMessageBox(_("Nothing to undo"));
AudacityMessageBox( XO("Nothing to undo") );
return;
}
@ -212,7 +212,7 @@ void OnRedo(const CommandContext &context)
auto &window = ProjectWindow::Get( project );
if (!ProjectHistory::Get( project ).RedoAvailable()) {
AudacityMessageBox(_("Nothing to redo"));
AudacityMessageBox( XO("Nothing to redo") );
return;
}
// Can't redo whilst dragging

View File

@ -222,7 +222,7 @@ void OnExportLabels(const CommandContext &context)
auto numLabelTracks = trackRange.size();
if (numLabelTracks == 0) {
AudacityMessageBox(_("There are no label tracks to export."));
AudacityMessageBox( XO("There are no label tracks to export.") );
return;
}
else
@ -260,8 +260,8 @@ void OnExportLabels(const CommandContext &context)
f.Create();
f.Open();
if (!f.IsOpened()) {
AudacityMessageBox( wxString::Format(
_("Couldn't write to file: %s"), fName ) );
AudacityMessageBox(
XO( "Couldn't write to file: %s" ).Format( fName ) );
return;
}
@ -294,13 +294,13 @@ void OnExportMIDI(const CommandContext &context)
const auto numNoteTracksSelected = range.size();
if(numNoteTracksSelected > 1) {
AudacityMessageBox(_(
"Please select only one Note Track at a time."));
AudacityMessageBox(
XO("Please select only one Note Track at a time.") );
return;
}
else if(numNoteTracksSelected < 1) {
AudacityMessageBox(_(
"Please select a Note Track."));
AudacityMessageBox(
XO("Please select a Note Track.") );
return;
}
@ -351,9 +351,10 @@ void OnExportMIDI(const CommandContext &context)
} else if(fName.EndsWith(wxT(".gro"))) {
nt->ExportAllegro(fName);
} else {
wxString msg = _("You have selected a filename with an unrecognized file extension.\nDo you want to continue?");
wxString title = _("Export MIDI");
int id = AudacityMessageBox(msg, title, wxYES_NO);
auto msg = XO(
"You have selected a filename with an unrecognized file extension.\nDo you want to continue?");
auto title = XO("Export MIDI");
int id = AudacityMessageBox( msg, title, wxYES_NO );
if (id == wxNO) {
continue;
} else if (id == wxYES) {
@ -433,7 +434,7 @@ void OnImportLabels(const CommandContext &context)
f.Open(fileName);
if (!f.IsOpened()) {
AudacityMessageBox(
wxString::Format( _("Could not open file: %s"), fileName ) );
XO("Could not open file: %s").Format( fileName ) );
return;
}

View File

@ -71,8 +71,8 @@ void ShowDiagnostics(
if (!text->SaveFile(fName))
{
AudacityMessageBox(
XO("Unable to save %s").Format( description ).Translation(),
fileDialogTitle.Translation());
XO("Unable to save %s").Format( description ),
fileDialogTitle);
}
}
}

View File

@ -641,7 +641,9 @@ void OnNewTimeTrack(const CommandContext &context)
auto &window = ProjectWindow::Get( project );
if ( *tracks.Any<TimeTrack>().begin() ) {
AudacityMessageBox(_("This version of Audacity only allows one time track for each project window."));
AudacityMessageBox(
XO(
"This version of Audacity only allows one time track for each project window.") );
return;
}
@ -748,8 +750,11 @@ void OnResample(const CommandContext &context)
break;
}
AudacityMessageBox(_("The entered value is invalid"), _("Error"),
wxICON_ERROR, &window);
AudacityMessageBox(
XO("The entered value is invalid"),
XO("Error"),
wxICON_ERROR,
&window);
}
int ndx = 0;
@ -910,7 +915,7 @@ void OnScoreAlign(const CommandContext &context)
numNoteTracksSelected != 1 ||
numOtherTracksSelected != 0){
AudacityMessageBox(
_("Please select at least one audio track and one MIDI track."));
XO("Please select at least one audio track and one MIDI track.") );
return;
}
@ -982,24 +987,27 @@ void OnScoreAlign(const CommandContext &context)
if (result == SA_SUCCESS) {
tracks->Replace(nt, holder);
AudacityMessageBox(wxString::Format(
_("Alignment completed: MIDI from %.2f to %.2f secs, Audio from %.2f to %.2f secs."),
params.mMidiStart, params.mMidiEnd,
params.mAudioStart, params.mAudioEnd));
AudacityMessageBox(
XO("Alignment completed: MIDI from %.2f to %.2f secs, Audio from %.2f to %.2f secs.")
.Format(
params.mMidiStart, params.mMidiEnd,
params.mAudioStart, params.mAudioEnd) );
ProjectHistory::Get( project )
.PushState(_("Sync MIDI with Audio"), _("Sync MIDI with Audio"));
} else if (result == SA_TOOSHORT) {
AudacityMessageBox(wxString::Format(
_("Alignment error: input too short: MIDI from %.2f to %.2f secs, Audio from %.2f to %.2f secs."),
params.mMidiStart, params.mMidiEnd,
params.mAudioStart, params.mAudioEnd));
AudacityMessageBox(
XO(
"Alignment error: input too short: MIDI from %.2f to %.2f secs, Audio from %.2f to %.2f secs.")
.Format(
params.mMidiStart, params.mMidiEnd,
params.mAudioStart, params.mAudioEnd) );
} else if (result == SA_CANCEL) {
// wrong way to recover...
//GetActiveProject()->OnUndo(); // recover any changes to note track
return; // no message when user cancels alignment
} else {
//GetActiveProject()->OnUndo(); // recover any changes to note track
AudacityMessageBox(_("Internal error reported by alignment process."));
AudacityMessageBox( XO("Internal error reported by alignment process.") );
}
}
#endif /* EXPERIMENTAL_SCOREALIGN */

View File

@ -250,9 +250,11 @@ void OnTimerRecord(const CommandContext &context)
// it is now safer to disable Timer Recording when there is more than
// one open project.
if (AllProjects{}.size() > 1) {
AudacityMessageBox(_("Timer Recording cannot be used with more than one open project.\n\nPlease close any additional projects and try again."),
_("Timer Recording"),
wxICON_INFORMATION | wxOK);
AudacityMessageBox(
XO(
"Timer Recording cannot be used with more than one open project.\n\nPlease close any additional projects and try again."),
XO("Timer Recording"),
wxICON_INFORMATION | wxOK);
return;
}
@ -262,9 +264,11 @@ void OnTimerRecord(const CommandContext &context)
// is used in Timer Recording.
if ((undoManager.UnsavedChanges()) &&
(TrackList::Get( project ).Any() || settings.EmptyCanBeDirty())) {
AudacityMessageBox(_("Timer Recording cannot be used while you have unsaved changes.\n\nPlease save or close this project and try again."),
_("Timer Recording"),
wxICON_INFORMATION | wxOK);
AudacityMessageBox(
XO(
"Timer Recording cannot be used while you have unsaved changes.\n\nPlease save or close this project and try again."),
XO("Timer Recording"),
wxICON_INFORMATION | wxOK);
return;
}
// We use this variable to display "Current Project" in the Timer Recording

View File

@ -229,17 +229,17 @@ bool DirectoriesPrefs::Validate()
wxString path{tempDir.GetPath()};
if( !FileNames::IsTempDirectoryNameOK( path ) ) {
AudacityMessageBox(
wxString::Format(_("Directory %s is not suitable (at risk of being cleaned out)"),
path),
_("Error"),
XO("Directory %s is not suitable (at risk of being cleaned out)")
.Format( path ),
XO("Error"),
wxOK | wxICON_ERROR);
return false;
}
if (!tempDir.DirExists()) {
int ans = AudacityMessageBox(
wxString::Format(_("Directory %s does not exist. Create it?"),
path),
_("New Temporary Directory"),
XO("Directory %s does not exist. Create it?")
.Format( path ),
XO("New Temporary Directory"),
wxYES_NO | wxCENTRE | wxICON_EXCLAMATION);
if (ans != wxYES) {
@ -258,9 +258,9 @@ bool DirectoriesPrefs::Validate()
path = tempDir.GetPath();
if (!tempDir.Mkdir(0755)) {
AudacityMessageBox(
wxString::Format(_("Directory %s is not writable"),
path),
_("Error"),
XO("Directory %s is not writable")
.Format( path ),
XO("Error"),
wxOK | wxICON_ERROR);
return false;
}
@ -272,8 +272,9 @@ bool DirectoriesPrefs::Validate()
oldDir.SetPath(gPrefs->Read(wxT("/Directories/TempDir")));
if (tempDir != oldDir) {
AudacityMessageBox(
_("Changes to temporary directory will not take effect until Audacity is restarted"),
_("Temp Directory Update"),
XO(
"Changes to temporary directory will not take effect until Audacity is restarted"),
XO("Temp Directory Update"),
wxOK | wxCENTRE | wxICON_INFORMATION);
}

View File

@ -524,12 +524,14 @@ void ExtImportPrefs::OnRuleTableEdit (wxGridEvent& event)
{
if (!askedAboutSpaces)
{
fixSpaces = AudacityMessageBox(_(
fixSpaces = AudacityMessageBox(
XO(
"There are space characters (spaces, newlines, tabs or linefeeds) in one of \
the items. They are likely to break the pattern matching. Unless you know \
what you are doing, it is recommended to trim spaces. Do you want \
Audacity to trim spaces for you?"
),_("Spaces detected"), wxYES_NO);
Audacity to trim spaces for you?"),
XO("Spaces detected"),
wxYES_NO);
askedAboutSpaces = true;
}
if (fixSpaces != wxYES)
@ -615,8 +617,11 @@ void ExtImportPrefs::OnDelRule(wxCommandEvent& WXUNUSED(event))
return;
auto &items = Importer::Get().GetImportItems();
int msgres = AudacityMessageBox (_("Do you really want to delete selected rule?"),
_("Rule deletion confirmation"), wxYES_NO, RuleTable);
int msgres = AudacityMessageBox (
XO("Do you really want to delete selected rule?"),
XO("Rule deletion confirmation"),
wxYES_NO,
RuleTable);
// Yes or no, there is no third!
if (msgres != wxYES)
return;

View File

@ -322,7 +322,8 @@ wxString GUIPrefs::SetLang( const wxString & lang )
if (!lang.empty() && lang != wxT("System")) {
info = wxLocale::FindLanguageInfo(lang);
if (!info)
::AudacityMessageBox(wxString::Format(_("Language \"%s\" is unknown"), lang));
::AudacityMessageBox(
XO("Language \"%s\" is unknown").Format( lang ) );
}
if (!info)
{

View File

@ -358,9 +358,11 @@ void KeyConfigPrefs::OnImport(wxCommandEvent & WXUNUSED(event))
XMLFileReader reader;
if (!reader.Parse(mManager, file)) {
AudacityMessageBox(reader.GetErrorStr().Translation(),
_("Error Importing Keyboard Shortcuts"),
wxOK | wxCENTRE, this);
AudacityMessageBox(
reader.GetErrorStr(),
XO("Error Importing Keyboard Shortcuts"),
wxOK | wxCENTRE,
this);
}
RefreshBindings(true);
@ -542,8 +544,11 @@ void KeyConfigPrefs::SetKeyForSelected(const NormalizedKeyString & key)
if (!mView->CanSetKey(mCommandSelected))
{
AudacityMessageBox(_("You may not assign a key to this entry"),
_("Error"), wxICON_ERROR | wxCENTRE, this);
AudacityMessageBox(
XO("You may not assign a key to this entry"),
XO("Error"),
wxICON_ERROR | wxCENTRE,
this);
return;
}
@ -556,8 +561,11 @@ void KeyConfigPrefs::SetKeyForSelected(const NormalizedKeyString & key)
void KeyConfigPrefs::OnSet(wxCommandEvent & WXUNUSED(event))
{
if (mCommandSelected == wxNOT_FOUND) {
AudacityMessageBox(_("You must select a binding before assigning a shortcut"),
_("Error"), wxICON_WARNING | wxCENTRE, this);
AudacityMessageBox(
XO("You must select a binding before assigning a shortcut"),
XO("Error"),
wxICON_WARNING | wxCENTRE,
this);
return;
}
@ -580,16 +588,17 @@ void KeyConfigPrefs::OnSet(wxCommandEvent & WXUNUSED(event))
.Format(
mManager->GetCategoryFromName(newname),
mManager->GetPrefixedLabelFromName(newname) );
if (AudacityMessageBox(
if (wxCANCEL == AudacityMessageBox(
XO(
"The keyboard shortcut '%s' is already assigned to:\n\n\t'%s'\n\nClick OK to assign the shortcut to\n\n\t'%s'\n\ninstead. Otherwise, click Cancel.")
.Format(
mKey->GetValue(),
oldlabel,
newlabel
)
.Translation(),
_("Error"), wxOK | wxCANCEL | wxICON_STOP | wxCENTRE, this) == wxCANCEL)
),
XO("Error"),
wxOK | wxCANCEL | wxICON_STOP | wxCENTRE,
this))
{
return;
}

View File

@ -233,9 +233,11 @@ void LibraryPrefs::OnFFmpegFindButton(wxCommandEvent & WXUNUSED(event))
// Libs are fine, don't show "locate" dialog unless user really wants it
if (!locate) {
int response = AudacityMessageBox(_("Audacity has automatically detected valid FFmpeg libraries.\nDo you still want to locate them manually?"),
wxT("Success"),
wxCENTRE | wxYES_NO | wxNO_DEFAULT |wxICON_QUESTION);
int response = AudacityMessageBox(
XO(
"Audacity has automatically detected valid FFmpeg libraries.\nDo you still want to locate them manually?"),
XO("Success"),
wxCENTRE | wxYES_NO | wxNO_DEFAULT |wxICON_QUESTION);
if (response == wxYES) {
locate = true;
}

View File

@ -294,7 +294,8 @@ bool MidiIOPrefs::Validate()
{
long latency;
if (!mLatency->GetValue().ToLong(&latency)) {
AudacityMessageBox(_("The MIDI Synthesizer Latency must be an integer"));
AudacityMessageBox( XO(
"The MIDI Synthesizer Latency must be an integer") );
return false;
}
return true;

View File

@ -184,7 +184,7 @@ bool SpectrogramSettings::Validate(bool quiet)
{
if (!quiet &&
maxFreq < 100) {
AudacityMessageBox(_("Maximum frequency must be 100 Hz or above"));
AudacityMessageBox( XO("Maximum frequency must be 100 Hz or above") );
return false;
}
else
@ -192,7 +192,7 @@ bool SpectrogramSettings::Validate(bool quiet)
if (!quiet &&
minFreq < 0) {
AudacityMessageBox(_("Minimum frequency must be at least 0 Hz"));
AudacityMessageBox( XO("Minimum frequency must be at least 0 Hz") );
return false;
}
else
@ -200,7 +200,8 @@ bool SpectrogramSettings::Validate(bool quiet)
if (!quiet &&
maxFreq <= minFreq) {
AudacityMessageBox(_("Minimum frequency must be less than maximum frequency"));
AudacityMessageBox( XO(
"Minimum frequency must be less than maximum frequency") );
return false;
}
else
@ -208,7 +209,7 @@ bool SpectrogramSettings::Validate(bool quiet)
if (!quiet &&
range <= 0) {
AudacityMessageBox(_("The range must be at least 1 dB"));
AudacityMessageBox( XO("The range must be at least 1 dB") );
return false;
}
else
@ -216,12 +217,13 @@ bool SpectrogramSettings::Validate(bool quiet)
if (!quiet &&
frequencyGain < 0) {
AudacityMessageBox(_("The frequency gain cannot be negative"));
AudacityMessageBox( XO("The frequency gain cannot be negative") );
return false;
}
else if (!quiet &&
frequencyGain > 60) {
AudacityMessageBox(_("The frequency gain must be no more than 60 dB/dec"));
AudacityMessageBox( XO(
"The frequency gain must be no more than 60 dB/dec") );
return false;
}
else

View File

@ -342,48 +342,49 @@ bool SpectrumPrefs::Validate()
long maxFreq;
if (!mMaxFreq->GetValue().ToLong(&maxFreq)) {
AudacityMessageBox(_("The maximum frequency must be an integer"));
AudacityMessageBox( XO("The maximum frequency must be an integer") );
return false;
}
long minFreq;
if (!mMinFreq->GetValue().ToLong(&minFreq)) {
AudacityMessageBox(_("The minimum frequency must be an integer"));
AudacityMessageBox( XO("The minimum frequency must be an integer") );
return false;
}
long gain;
if (!mGain->GetValue().ToLong(&gain)) {
AudacityMessageBox(_("The gain must be an integer"));
AudacityMessageBox( XO("The gain must be an integer") );
return false;
}
long range;
if (!mRange->GetValue().ToLong(&range)) {
AudacityMessageBox(_("The range must be a positive integer"));
AudacityMessageBox( XO("The range must be a positive integer") );
return false;
}
long frequencygain;
if (!mFrequencyGain->GetValue().ToLong(&frequencygain)) {
AudacityMessageBox(_("The frequency gain must be an integer"));
AudacityMessageBox( XO("The frequency gain must be an integer") );
return false;
}
#ifdef EXPERIMENTAL_FIND_NOTES
long findNotesMinA;
if (!mFindNotesMinA->GetValue().ToLong(&findNotesMinA)) {
AudacityMessageBox(_("The minimum amplitude (dB) must be an integer"));
AudacityMessageBox( XO("The minimum amplitude (dB) must be an integer") );
return false;
}
long findNotesN;
if (!mFindNotesN->GetValue().ToLong(&findNotesN)) {
AudacityMessageBox(_("The maximum number of notes must be an integer"));
AudacityMessageBox( XO("The maximum number of notes must be an integer") );
return false;
}
if (findNotesN < 1 || findNotesN > 128) {
AudacityMessageBox(_("The maximum number of notes must be in the range 1..128"));
AudacityMessageBox( XO(
"The maximum number of notes must be in the range 1..128") );
return false;
}
#endif //EXPERIMENTAL_FIND_NOTES

View File

@ -829,7 +829,7 @@ void DeviceToolBar::ShowChannelsDialog()
void DeviceToolBar::ShowComboDialog(wxChoice *combo, const TranslatableString &title)
{
if (!combo || combo->GetCount() == 0) {
AudacityMessageBox(_("Device information is not available."));
AudacityMessageBox( XO("Device information is not available.") );
return;
}

View File

@ -178,9 +178,10 @@ namespace {
const double time = adjustTime(wt, viewInfo.PositionToTime(event.m_x, rect.x));
if (!SampleResolutionTest(viewInfo, wt, time, width))
{
AudacityMessageBox(_(
AudacityMessageBox(
XO(
"To use Draw, zoom in further until you can see the individual samples."),
_("Draw Tool"));
XO("Draw Tool"));
return false;
}
return true;

View File

@ -533,8 +533,11 @@ void RateMenuTable::OnRateOther(wxCommandEvent &)
break;
}
AudacityMessageBox(_("The entered value is invalid"), _("Error"),
wxICON_ERROR, mpData->pParent);
AudacityMessageBox(
XO("The entered value is invalid"),
XO("Error"),
wxICON_ERROR,
mpData->pParent);
}
SetRate(pTrack, newRate);
@ -802,9 +805,11 @@ void WaveTrackMenuTable::OnSpectrogramSettings(wxCommandEvent &)
auto gAudioIO = AudioIOBase::Get();
if (gAudioIO->IsBusy()){
AudacityMessageBox(_("To change Spectrogram Settings, stop any\n"
"playing or recording first."),
_("Stop the Audio First"), wxOK | wxICON_EXCLAMATION | wxCENTRE);
AudacityMessageBox(
XO(
"To change Spectrogram Settings, stop any\n playing or recording first."),
XO("Stop the Audio First"),
wxOK | wxICON_EXCLAMATION | wxCENTRE);
return;
}

View File

@ -17,13 +17,14 @@
extern TranslatableString AudacityMessageBoxCaptionStr();
// Do not use wxMessageBox!! Its default window title does not translate!
inline int AudacityMessageBox(const wxString& message,
const wxString& caption = AudacityMessageBoxCaptionStr().Translation(),
long style = wxOK | wxCENTRE,
wxWindow *parent = NULL,
int x = wxDefaultCoord, int y = wxDefaultCoord)
inline int AudacityMessageBox(const TranslatableString& message,
const TranslatableString& caption = AudacityMessageBoxCaptionStr(),
long style = wxOK | wxCENTRE,
wxWindow *parent = NULL,
int x = wxDefaultCoord, int y = wxDefaultCoord)
{
return ::wxMessageBox(message, caption, style, parent, x, y);
return ::wxMessageBox(message.Translation(), caption.Translation(),
style, parent, x, y);
}
#endif

View File

@ -96,13 +96,16 @@ bool NumValidatorBase::Validate(wxWindow *parent)
if ( !m_validatorWindow->IsEnabled() )
return true;
wxString errmsg;
TranslatableString errmsg;
bool res = DoValidateNumber(&errmsg);
if ( !res )
{
AudacityMessageBox(errmsg, _("Validation error"),
wxOK | wxICON_ERROR, parent);
AudacityMessageBox(
errmsg,
XO("Validation error"),
wxOK | wxICON_ERROR,
parent);
wxTextEntry *te = GetTextEntry();
if ( te )
{
@ -348,7 +351,7 @@ IntegerValidatorBase::IsCharOk(const wxString& val, int pos, wxChar ch) const
return true;
}
bool IntegerValidatorBase::DoValidateNumber(wxString * errMsg) const
bool IntegerValidatorBase::DoValidateNumber(TranslatableString * errMsg) const
{
wxTextEntry * const control = GetTextEntry();
if ( !control )
@ -369,7 +372,7 @@ bool IntegerValidatorBase::DoValidateNumber(wxString * errMsg) const
// We can't do any check with an empty string
else
{
*errMsg = _("Empty value");
*errMsg = XO("Empty value");
return false;
}
}
@ -378,13 +381,13 @@ bool IntegerValidatorBase::DoValidateNumber(wxString * errMsg) const
LongestValueType value;
bool res = FromString(s, &value);
if ( !res )
*errMsg = _("Malformed number");
*errMsg = XO("Malformed number");
else
{
res = IsInRange(value);
if ( !res )
errMsg->Printf(_("Not in range %d to %d"),
(int) m_min, (int) m_max);
*errMsg = XO("Not in range %d to %d")
.Format( (int) m_min, (int) m_max );
}
return res;
@ -474,7 +477,7 @@ FloatingPointValidatorBase::IsCharOk(const wxString& val,
return ValidatePrecision(str);
}
bool FloatingPointValidatorBase::DoValidateNumber(wxString * errMsg) const
bool FloatingPointValidatorBase::DoValidateNumber(TranslatableString * errMsg) const
{
wxTextEntry * const control = GetTextEntry();
if ( !control )
@ -491,7 +494,7 @@ bool FloatingPointValidatorBase::DoValidateNumber(wxString * errMsg) const
return true; //Is blank, but allowed. Stop here
else
{
*errMsg = _("Empty value");
*errMsg = XO("Empty value");
return false; //We can't do any checks with an empty string
}
}
@ -499,12 +502,12 @@ bool FloatingPointValidatorBase::DoValidateNumber(wxString * errMsg) const
LongestValueType value;
bool res = FromString(s, &value); // Can it be converted to a value?
if ( !res )
*errMsg = _("Value overflow");
*errMsg = XO("Value overflow");
else
{
res = ValidatePrecision(s);
if ( !res )
*errMsg = _("Too many decimal digits");
*errMsg = XO("Too many decimal digits");
else
{
res = IsInRange(value);
@ -517,16 +520,17 @@ bool FloatingPointValidatorBase::DoValidateNumber(wxString * errMsg) const
if (m_minSet && m_maxSet)
{
errMsg->Printf(_("Value not in range: %s to %s"),
strMin, strMax);
*errMsg = XO("Value not in range: %s to %s")
.Format( strMin, strMax );
}
else if (m_minSet)
{
errMsg->Printf(_("Value must not be less than %s"), strMin);
*errMsg = XO("Value must not be less than %s").Format( strMin );
}
else if (m_maxSet)
{
errMsg->Printf(_("Value must not be greather than %s"), strMax);
*errMsg = XO("Value must not be greather than %s")
.Format( strMax );
}
}
}

View File

@ -22,6 +22,8 @@
#include <limits>
class TranslatableString;
// Bit masks used for numeric validator styles.
enum class NumValidatorStyle : int
{
@ -116,7 +118,7 @@ private:
// Do all checks to ensure this is a valid value.
// Returns 'true' if the control has valid value.
// Otherwise the cause is indicated in 'errMsg'.
virtual bool DoValidateNumber(wxString * errMsg) const = 0;
virtual bool DoValidateNumber(TranslatableString * errMsg) const = 0;
// Event handlers.
void OnChar(wxKeyEvent& event);
@ -321,7 +323,7 @@ protected:
// Implement NumValidatorBase pure virtual method.
bool IsCharOk(const wxString& val, int pos, wxChar ch) const override;
bool DoValidateNumber(wxString * errMsg) const override;
bool DoValidateNumber(TranslatableString * errMsg) const override;
private:
// Minimal and maximal values accepted (inclusive).
@ -421,7 +423,7 @@ protected:
// Implement NumValidatorBase pure virtual method.
bool IsCharOk(const wxString& val, int pos, wxChar ch) const override;
bool DoValidateNumber(wxString * errMsg) const override;
bool DoValidateNumber(TranslatableString * errMsg) const override;
//Checks that it doesn't have too many decimal digits.
bool ValidatePrecision(const wxString& s) const;