1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

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

@@ -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
{