FileNames::SelectFile takes TranslatableString for message

This commit is contained in:
Paul Licameli 2019-12-18 16:32:21 -05:00
parent 71e9e38083
commit ae42397d64
17 changed files with 34 additions and 36 deletions

View File

@ -251,7 +251,7 @@ void AudacityLogger::OnSave(wxCommandEvent & WXUNUSED(e))
wxString fName = _("log.txt");
fName = FileNames::SelectFile(FileNames::Operation::Export,
_("Save log to:"),
XO("Save log to:"),
wxEmptyString,
fName,
wxT("txt"),

View File

@ -260,7 +260,7 @@ void BenchmarkDialog::OnSave( wxCommandEvent & WXUNUSED(event))
wxString fName = _("benchmark.txt");
fName = FileNames::SelectFile(FileNames::Operation::Export,
_("Export Benchmark Data as:"),
XO("Export Benchmark Data as:"),
wxEmptyString,
fName,
wxT("txt"),

View File

@ -510,11 +510,10 @@ public:
void OnBrowse(wxCommandEvent & WXUNUSED(event))
{
wxString question;
/* i18n-hint: It's asking for the location of a file, for
example, "Where is lame_enc.dll?" - you could translate
"Where would I find the file '%s'?" instead if you want. */
question.Printf(_("Where is '%s'?"), mName);
auto question = XO("Where is '%s'?").Format( mName );
wxString path = FileNames::SelectFile(FileNames::Operation::_None,
question,

View File

@ -462,7 +462,7 @@ void FileNames::UpdateDefaultPath(Operation op, const FilePath &path)
wxString
FileNames::SelectFile(Operation op,
const wxString& message,
const TranslatableString& message,
const FilePath& default_path,
const FilePath& default_filename,
const wxString& default_extension,
@ -472,7 +472,7 @@ FileNames::SelectFile(Operation op,
{
return WithDefaultPath(op, default_path, [&](const FilePath &path) {
return FileSelector(
message, path, default_filename, default_extension,
message.Translation(), path, default_filename, default_extension,
wildcard, flags, parent, wxDefaultCoord, wxDefaultCoord);
});
}
@ -618,7 +618,7 @@ char *FileNames::VerifyFilename(const wxString &s, bool input)
ext = ff.GetExt();
name = FileNames::SelectFile(FileNames::Operation::_None,
_("Specify New Filename:"),
XO("Specify New Filename:"),
wxEmptyString,
name,
ext,

View File

@ -127,7 +127,7 @@ public:
static wxString
SelectFile(Operation op, // op matters only when default_path is empty
const wxString& message,
const TranslatableString& message,
const FilePath& default_path,
const FilePath& default_filename,
// empty, or one extension, or multiple extensions joined with

View File

@ -1061,7 +1061,7 @@ void FrequencyPlotDialog::OnExport(wxCommandEvent & WXUNUSED(event))
wxString fName = _("spectrum.txt");
fName = FileNames::SelectFile(FileNames::Operation::Export,
_("Export Spectral Data As:"),
XO("Export Spectral Data As:"),
wxEmptyString,
fName,
wxT("txt"),

View File

@ -628,7 +628,7 @@ void LabelDialog::OnImport(wxCommandEvent & WXUNUSED(event))
// Ask user for a filename
wxString fileName =
FileNames::SelectFile(FileNames::Operation::Open,
_("Select a text file containing labels"),
XO("Select a text file containing labels"),
wxEmptyString, // Path
wxT(""), // Name
wxT(".txt"), // Extension
@ -677,7 +677,7 @@ void LabelDialog::OnExport(wxCommandEvent & WXUNUSED(event))
wxString fName = mTrackNames[mTrackNames.size() - 1].AfterFirst(wxT('-')).Mid(1);
fName = FileNames::SelectFile(FileNames::Operation::Export,
_("Export Labels As:"),
XO("Export Labels As:"),
wxEmptyString,
fName,
wxT("txt"),

View File

@ -785,14 +785,14 @@ bool ProjectFileManager::SaveAs(bool bWantSaveCopy /*= false*/, bool bLossless /
filename = FileNames::DefaultToDocumentsFolder(wxT("/SaveAs/Path"));
}
wxString title;
TranslatableString title;
wxString message;
if (bWantSaveCopy)
{
if (bLossless)
{
title = wxString::Format(_("%sSave Lossless Copy of Project \"%s\" As..."),
Restorer.sProjNumber,Restorer.sProjName);
title = XO("%sSave Lossless Copy of Project \"%s\" As...")
.Format( Restorer.sProjNumber,Restorer.sProjName );
message = _("\
'Save Lossless Copy of Project' is for an Audacity project, not an audio file.\n\
For an audio file that will open in other apps, use 'Export'.\n\n\
@ -802,8 +802,8 @@ with no loss of quality, but the projects are large.\n");
}
else
{
title = wxString::Format(_("%sSave Compressed Copy of Project \"%s\" As..."),
Restorer.sProjNumber,Restorer.sProjName);
title = XO("%sSave Compressed Copy of Project \"%s\" As...")
.Format( Restorer.sProjNumber, Restorer.sProjName );
message = _("\
'Save Compressed Copy of Project' is for an Audacity project, not an audio file.\n\
For an audio file that will open in other apps, use 'Export'.\n\n\
@ -814,8 +814,8 @@ but they have some loss of fidelity.\n");
}
else
{
title = wxString::Format(_("%sSave Project \"%s\" As..."),
Restorer.sProjNumber, Restorer.sProjName);
title = XO("%sSave Project \"%s\" As...")
.Format( Restorer.sProjNumber, Restorer.sProjName );
message = _("\
'Save Project' is for an Audacity project, not an audio file.\n\
For an audio file that will open in other apps, use 'Export'.\n");

View File

@ -1244,7 +1244,7 @@ void TagsEditorDialog::OnLoad(wxCommandEvent & WXUNUSED(event))
// Ask the user for the real name
fn = FileNames::SelectFile(FileNames::Operation::_None,
_("Load Metadata As:"),
XO("Load Metadata As:"),
FileNames::DataDir(),
wxT("Tags.xml"),
wxT("xml"),
@ -1299,7 +1299,7 @@ void TagsEditorDialog::OnSave(wxCommandEvent & WXUNUSED(event))
// Ask the user for the real name
fn = FileNames::SelectFile(FileNames::Operation::_None,
_("Save Metadata As:"),
XO("Save Metadata As:"),
FileNames::DataDir(),
wxT("Tags.xml"),
wxT("xml"),

View File

@ -318,7 +318,7 @@ void TimerRecordDialog::OnTimeText_Duration(wxCommandEvent& WXUNUSED(event))
void TimerRecordDialog::OnAutoSavePathButton_Click(wxCommandEvent& WXUNUSED(event))
{
wxString fName = FileNames::SelectFile(FileNames::Operation::Export,
_("Save Timer Recording As"),
XO("Save Timer Recording As"),
m_fnAutoSaveFile.GetPath(),
m_fnAutoSaveFile.GetFullName(),
wxT("aup"),

View File

@ -528,7 +528,7 @@ void ContrastDialog::OnExport(wxCommandEvent & WXUNUSED(event))
wxString fName = wxT("contrast.txt");
fName = FileNames::SelectFile(FileNames::Operation::Export,
_("Export Contrast Result As:"),
XO("Export Contrast Result As:"),
wxEmptyString,
fName,
wxT("txt"),

View File

@ -1861,7 +1861,7 @@ void VSTEffect::ExportPresets()
// Passing a valid parent will cause some effects dialogs to malfunction
// upon returning from the FileNames::SelectFile().
path = FileNames::SelectFile(FileNames::Operation::_None,
_("Save VST Preset As:"),
XO("Save VST Preset As:"),
FileNames::DataDir(),
wxEmptyString,
wxT("xml"),
@ -1913,7 +1913,7 @@ void VSTEffect::ImportPresets()
// Ask the user for the real name
path = FileNames::SelectFile(FileNames::Operation::_None,
_("Load VST Preset:"),
XO("Load VST Preset:"),
FileNames::DataDir(),
wxEmptyString,
wxT("xml"),

View File

@ -176,7 +176,7 @@ void ExportCLOptions::OnBrowse(wxCommandEvent& WXUNUSED(event))
#endif
path = FileNames::SelectFile(FileNames::Operation::Open,
_("Find path to command"),
XO("Find path to command"),
wxEmptyString,
wxEmptyString,
ext,

View File

@ -619,11 +619,10 @@ public:
void OnBrowse(wxCommandEvent & WXUNUSED(event))
{
wxString question;
/* i18n-hint: It's asking for the location of a file, for
* example, "Where is lame_enc.dll?" - you could translate
* "Where would I find the file %s" instead if you want. */
question.Printf(_("Where is %s?"), mName);
auto question = XO("Where is %s?").Format( mName );
wxString path = FileNames::SelectFile(FileNames::Operation::_None,
question,

View File

@ -229,7 +229,7 @@ void OnExportLabels(const CommandContext &context)
fName = (*trackRange.rbegin())->GetName();
fName = FileNames::SelectFile(FileNames::Operation::Export,
_("Export Labels As:"),
XO("Export Labels As:"),
wxEmptyString,
fName,
wxT("txt"),
@ -315,7 +315,7 @@ void OnExportMIDI(const CommandContext &context)
wxString fName;
fName = FileNames::SelectFile(FileNames::Operation::Export,
_("Export MIDI As:"),
XO("Export MIDI As:"),
wxEmptyString,
fName,
wxT(".mid|.gro"),
@ -419,7 +419,7 @@ void OnImportLabels(const CommandContext &context)
wxString fileName =
FileNames::SelectFile(FileNames::Operation::Open,
_("Select a text file containing labels"),
XO("Select a text file containing labels"),
wxEmptyString, // Path
wxT(""), // Name
wxT(".txt"), // Extension
@ -463,7 +463,7 @@ void OnImportMIDI(const CommandContext &context)
auto &window = GetProjectFrame( project );
wxString fileName = FileNames::SelectFile(FileNames::Operation::Open,
_("Select a MIDI file"),
XO("Select a MIDI file"),
wxEmptyString, // Path
wxT(""), // Name
wxT(""), // Extension
@ -484,7 +484,7 @@ void OnImportRaw(const CommandContext &context)
wxString fileName =
FileNames::SelectFile(FileNames::Operation::Open,
_("Select any uncompressed audio file"),
XO("Select any uncompressed audio file"),
wxEmptyString, // Path
wxT(""), // Name
wxT(""), // Extension

View File

@ -57,7 +57,7 @@ void ShowDiagnostics(
if (dlg.ShowModal() == wxID_OK)
{
const auto fileDialogTitle = XO("Save %s").Format( description ).Translation();
const auto fileDialogTitle = XO("Save %s").Format( description );
wxString fName = FileNames::SelectFile(FileNames::Operation::Export,
fileDialogTitle,
wxEmptyString,
@ -72,7 +72,7 @@ void ShowDiagnostics(
{
AudacityMessageBox(
XO("Unable to save %s").Format( description ).Translation(),
fileDialogTitle);
fileDialogTitle.Translation());
}
}
}

View File

@ -344,7 +344,7 @@ void KeyConfigPrefs::OnImport(wxCommandEvent & WXUNUSED(event))
wxString file = wxT("Audacity-keys.xml");
file = FileNames::SelectFile(FileNames::Operation::Open,
_("Select an XML file containing Audacity keyboard shortcuts..."),
XO("Select an XML file containing Audacity keyboard shortcuts..."),
wxEmptyString,
file,
wxT(""),
@ -371,7 +371,7 @@ void KeyConfigPrefs::OnExport(wxCommandEvent & WXUNUSED(event))
wxString file = wxT("Audacity-keys.xml");
file = FileNames::SelectFile(FileNames::Operation::Export,
_("Export Keyboard Shortcuts As:"),
XO("Export Keyboard Shortcuts As:"),
wxEmptyString,
file,
wxT("xml"),