1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Refactored some TRANS strings to make them more amenable to translation. Added the NEEDS_TRANS macro.

This commit is contained in:
jules 2013-05-05 17:13:53 +01:00
parent ffc9200ea7
commit 4d61bfd8a3
13 changed files with 101 additions and 89 deletions

View file

@ -98,8 +98,8 @@ bool FileBasedDocument::loadFrom (const File& newFile,
{
AlertWindow::showMessageBox (AlertWindow::WarningIcon,
TRANS("Failed to open file..."),
TRANS("There was an error while trying to load the file:\n\n")
+ newFile.getFullPathName()
TRANS("There was an error while trying to load the file: FLNM")
.replace ("FLNM", "\n" + newFile.getFullPathName())
+ "\n\n"
+ result.getErrorMessage());
}
@ -119,6 +119,18 @@ bool FileBasedDocument::loadFromUserSpecifiedFile (const bool showMessageOnFailu
return false;
}
static bool askToOverwriteFile (const File& newFile)
{
return AlertWindow::showOkCancelBox (AlertWindow::WarningIcon,
TRANS("File already exists"),
TRANS("There's already a file called: FLMN")
.replace ("FLNM", newFile.getFullPathName())
+ "\n\n"
+ TRANS("Are you sure you want to overwrite it?"),
TRANS("Overwrite"),
TRANS("Cancel"));
}
//==============================================================================
FileBasedDocument::SaveResult FileBasedDocument::save (const bool askUserForFileIfNotSpecified,
const bool showMessageOnFailure)
@ -144,19 +156,10 @@ FileBasedDocument::SaveResult FileBasedDocument::saveAs (const File& newFile,
return failedToWriteToFile;
}
if (warnAboutOverwritingExistingFiles && newFile.exists())
{
if (! AlertWindow::showOkCancelBox (AlertWindow::WarningIcon,
TRANS("File already exists"),
TRANS("There's already a file called:\n\n")
+ newFile.getFullPathName()
+ TRANS("\n\nAre you sure you want to overwrite it?"),
TRANS("overwrite"),
TRANS("cancel")))
{
return userCancelledSave;
}
}
if (warnAboutOverwritingExistingFiles
&& newFile.exists()
&& ! askToOverwriteFile (newFile))
return userCancelledSave;
MouseCursor::showWaitCursor();
@ -180,10 +183,9 @@ FileBasedDocument::SaveResult FileBasedDocument::saveAs (const File& newFile,
{
AlertWindow::showMessageBox (AlertWindow::WarningIcon,
TRANS("Error writing to file..."),
TRANS("An error occurred while trying to save \"")
+ getDocumentTitle()
+ TRANS("\" to the file:\n\n")
+ newFile.getFullPathName()
TRANS("An error occurred while trying to save \"DCNM\" to the file: FLNM")
.replace ("DCNM", getDocumentTitle())
.replace ("FLNM", "\n" + newFile.getFullPathName())
+ "\n\n"
+ result.getErrorMessage());
}
@ -198,11 +200,11 @@ FileBasedDocument::SaveResult FileBasedDocument::saveIfNeededAndUserAgrees()
const int r = AlertWindow::showYesNoCancelBox (AlertWindow::QuestionIcon,
TRANS("Closing document..."),
TRANS("Do you want to save the changes to \"")
+ getDocumentTitle() + "\"?",
TRANS("save"),
TRANS("discard changes"),
TRANS("cancel"));
TRANS("Do you want to save the changes to \"DCNM\"?")
.replace ("DCNM", getDocumentTitle()),
TRANS("Save"),
TRANS("Discard changes"),
TRANS("Cancel"));
if (r == 1) // save changes
return save (true, true);
@ -248,19 +250,8 @@ FileBasedDocument::SaveResult FileBasedDocument::saveAsInteractive (const bool w
{
chosen = chosen.withFileExtension (fileExtension);
if (chosen.exists())
{
if (! AlertWindow::showOkCancelBox (AlertWindow::WarningIcon,
TRANS("File already exists"),
TRANS("There's already a file called:")
+ "\n\n" + chosen.getFullPathName()
+ "\n\n" + TRANS("Are you sure you want to overwrite it?"),
TRANS("overwrite"),
TRANS("cancel")))
{
return userCancelledSave;
}
}
if (chosen.exists() && ! askToOverwriteFile (chosen))
return userCancelledSave;
}
setLastDocumentOpened (chosen);