mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-10 17:11:17 +02:00
MultiDialog uses TranslatableString for button labels & 2nd message
This commit is contained in:
parent
0247329077
commit
66097c34dc
@ -274,9 +274,13 @@ void ModuleManager::Initialize(CommandHandler &cmdHandler)
|
|||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf(_("Module \"%s\" found."), ShortName);
|
msg.Printf(_("Module \"%s\" found."), ShortName);
|
||||||
msg += _("\n\nOnly use modules from trusted sources");
|
msg += _("\n\nOnly use modules from trusted sources");
|
||||||
const wxChar *buttons[] = {_("Yes"), _("No"), NULL}; // could add a button here for 'yes and remember that', and put it into the cfg file. Needs more thought.
|
const TranslatableStrings buttons{
|
||||||
|
XO("Yes"), XO("No"),
|
||||||
|
}; // could add a button here for 'yes and remember that', and put it into the cfg file. Needs more thought.
|
||||||
int action;
|
int action;
|
||||||
action = ShowMultiDialog(msg, XO("Audacity Module Loader"), buttons, _("Try and load this module?"), false);
|
action = ShowMultiDialog(msg, XO("Audacity Module Loader"),
|
||||||
|
buttons,
|
||||||
|
XO("Try and load this module?"), false);
|
||||||
#ifdef EXPERIMENTAL_MODULE_PREFS
|
#ifdef EXPERIMENTAL_MODULE_PREFS
|
||||||
// If we're not prompting always, accept the answer permanantly
|
// If we're not prompting always, accept the answer permanantly
|
||||||
if( iModuleStatus == kModuleNew ){
|
if( iModuleStatus == kModuleNew ){
|
||||||
|
@ -56,10 +56,10 @@ int ProjectFSCK(
|
|||||||
The error message is confusing to users in English, and could just say
|
The error message is confusing to users in English, and could just say
|
||||||
"Found problems with <sequence> when checking project file." */
|
"Found problems with <sequence> when checking project file." */
|
||||||
wxString msg = _("Project check read faulty Sequence tags.");
|
wxString msg = _("Project check read faulty Sequence tags.");
|
||||||
const wxChar *buttons[] =
|
const TranslatableStrings buttons{
|
||||||
{_("Close project immediately with no changes"),
|
XO("Close project immediately with no changes"),
|
||||||
_("Continue with repairs noted in log, and check for more errors. This will save the project in its current state, unless you \"Close project immediately\" on further error alerts."),
|
XO("Continue with repairs noted in log, and check for more errors. This will save the project in its current state, unless you \"Close project immediately\" on further error alerts.")
|
||||||
NULL};
|
};
|
||||||
wxLog::FlushActive(); // MultiDialog has "Show Log..." button, so make sure log is current.
|
wxLog::FlushActive(); // MultiDialog has "Show Log..." button, so make sure log is current.
|
||||||
action = ShowMultiDialog(msg, XO("Warning - Problems Reading Sequence Tags"), buttons);
|
action = ShowMultiDialog(msg, XO("Warning - Problems Reading Sequence Tags"), buttons);
|
||||||
if (action == 0)
|
if (action == 0)
|
||||||
@ -110,11 +110,11 @@ _("Project check of \"%s\" folder \
|
|||||||
\nproject immediately\" on further error alerts.");
|
\nproject immediately\" on further error alerts.");
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf(msgA, dm.GetProjectName(), (long long) missingAliasFilesPathHash.size());
|
msg.Printf(msgA, dm.GetProjectName(), (long long) missingAliasFilesPathHash.size());
|
||||||
const wxChar *buttons[] =
|
const TranslatableStrings buttons{
|
||||||
{_("Close project immediately with no changes"),
|
XO("Close project immediately with no changes"),
|
||||||
_("Treat missing audio as silence (this session only)"),
|
XO("Treat missing audio as silence (this session only)"),
|
||||||
_("Replace missing audio with silence (permanent immediately)."),
|
XO("Replace missing audio with silence (permanent immediately)."),
|
||||||
NULL};
|
};
|
||||||
wxLog::FlushActive(); // MultiDialog has "Show Log..." button, so make sure log is current.
|
wxLog::FlushActive(); // MultiDialog has "Show Log..." button, so make sure log is current.
|
||||||
action = ShowMultiDialog(msg, XO("Warning - Missing Aliased File(s)"), buttons);
|
action = ShowMultiDialog(msg, XO("Warning - Missing Aliased File(s)"), buttons);
|
||||||
}
|
}
|
||||||
@ -188,10 +188,11 @@ _("Project check of \"%s\" folder \
|
|||||||
\nfrom the current audio in the project.");
|
\nfrom the current audio in the project.");
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf(msgA, dm.GetProjectName(), (long long) missingAUFHash.size());
|
msg.Printf(msgA, dm.GetProjectName(), (long long) missingAUFHash.size());
|
||||||
const wxChar *buttons[] = {_("Regenerate alias summary files (safe and recommended)"),
|
const TranslatableStrings buttons{
|
||||||
_("Fill in silence for missing display data (this session only)"),
|
XO("Regenerate alias summary files (safe and recommended)"),
|
||||||
_("Close project immediately with no further changes"),
|
XO("Fill in silence for missing display data (this session only)"),
|
||||||
NULL};
|
XO("Close project immediately with no further changes"),
|
||||||
|
};
|
||||||
wxLog::FlushActive(); // MultiDialog has "Show Log..." button, so make sure log is current.
|
wxLog::FlushActive(); // MultiDialog has "Show Log..." button, so make sure log is current.
|
||||||
action = ShowMultiDialog(msg, XO("Warning - Missing Alias Summary File(s)"), buttons);
|
action = ShowMultiDialog(msg, XO("Warning - Missing Alias Summary File(s)"), buttons);
|
||||||
}
|
}
|
||||||
@ -260,11 +261,11 @@ _("Project check of \"%s\" folder \
|
|||||||
\nmay not show silence.");
|
\nmay not show silence.");
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf(msgA, dm.GetProjectName(), (long long) missingAUHash.size());
|
msg.Printf(msgA, dm.GetProjectName(), (long long) missingAUHash.size());
|
||||||
const wxChar *buttons[] =
|
const TranslatableStrings buttons{
|
||||||
{_("Close project immediately with no further changes"),
|
XO("Close project immediately with no further changes"),
|
||||||
_("Treat missing audio as silence (this session only)"),
|
XO("Treat missing audio as silence (this session only)"),
|
||||||
_("Replace missing audio with silence (permanent immediately)"),
|
XO("Replace missing audio with silence (permanent immediately)"),
|
||||||
NULL};
|
};
|
||||||
wxLog::FlushActive(); // MultiDialog has "Show Log..." button, so make sure log is current.
|
wxLog::FlushActive(); // MultiDialog has "Show Log..." button, so make sure log is current.
|
||||||
action = ShowMultiDialog(msg, XO("Warning - Missing Audio Data Block File(s)"), buttons);
|
action = ShowMultiDialog(msg, XO("Warning - Missing Audio Data Block File(s)"), buttons);
|
||||||
}
|
}
|
||||||
@ -333,11 +334,11 @@ other projects. \
|
|||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf(msgA, dm.GetProjectName(), (int)orphanFilePathArray.size());
|
msg.Printf(msgA, dm.GetProjectName(), (int)orphanFilePathArray.size());
|
||||||
|
|
||||||
const wxChar *buttons[] =
|
const TranslatableStrings buttons{
|
||||||
{_("Continue without deleting; ignore the extra files this session"),
|
XO("Continue without deleting; ignore the extra files this session"),
|
||||||
_("Close project immediately with no further changes"),
|
XO("Close project immediately with no further changes"),
|
||||||
_("Delete orphan files (permanent immediately)"),
|
XO("Delete orphan files (permanent immediately)"),
|
||||||
NULL};
|
};
|
||||||
wxLog::FlushActive(); // MultiDialog has "Show Log..." button, so make sure log is current.
|
wxLog::FlushActive(); // MultiDialog has "Show Log..." button, so make sure log is current.
|
||||||
action = ShowMultiDialog(msg, XO("Warning - Orphan Block File(s)"), buttons);
|
action = ShowMultiDialog(msg, XO("Warning - Orphan Block File(s)"), buttons);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,8 @@ public:
|
|||||||
MultiDialog(wxWindow * pParent,
|
MultiDialog(wxWindow * pParent,
|
||||||
wxString message,
|
wxString message,
|
||||||
const TranslatableString &title,
|
const TranslatableString &title,
|
||||||
const wxChar **buttons, wxString boxMsg, bool log);
|
const TranslatableStrings &buttons,
|
||||||
|
const TranslatableString &boxMsg, bool log);
|
||||||
~MultiDialog() {};
|
~MultiDialog() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -63,7 +64,8 @@ END_EVENT_TABLE()
|
|||||||
MultiDialog::MultiDialog(wxWindow * pParent,
|
MultiDialog::MultiDialog(wxWindow * pParent,
|
||||||
wxString message,
|
wxString message,
|
||||||
const TranslatableString &title,
|
const TranslatableString &title,
|
||||||
const wxChar **buttons, wxString boxMsg, bool log)
|
const TranslatableStrings &buttons,
|
||||||
|
const TranslatableString &boxMsg, bool log)
|
||||||
: wxDialogWrapper(pParent, wxID_ANY, title,
|
: wxDialogWrapper(pParent, wxID_ANY, title,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxCAPTION) // not wxDEFAULT_DIALOG_STYLE because we don't want wxCLOSE_BOX and wxSYSTEM_MENU
|
wxCAPTION) // not wxDEFAULT_DIALOG_STYLE because we don't want wxCLOSE_BOX and wxSYSTEM_MENU
|
||||||
@ -92,22 +94,19 @@ MultiDialog::MultiDialog(wxWindow * pParent,
|
|||||||
vSizer->Add(iconAndTextSizer.release(), 0, wxALIGN_LEFT | wxALL, 5);
|
vSizer->Add(iconAndTextSizer.release(), 0, wxALIGN_LEFT | wxALL, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t count = 0;
|
const auto buttonLabels = transform_container<wxArrayStringEx>(
|
||||||
while (buttons[count])count++;
|
buttons, std::mem_fn( &TranslatableString::Translation ) );
|
||||||
ArrayOf<wxString> buttonLabels{ count };
|
|
||||||
|
|
||||||
count = 0;
|
const auto count = buttons.size();
|
||||||
while (buttons[count]){
|
|
||||||
buttonLabels[count] = buttons[count];
|
const auto boxStr = boxMsg.Translation();
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
mRadioBox = safenew wxRadioBox(this, -1,
|
mRadioBox = safenew wxRadioBox(this, -1,
|
||||||
boxMsg,
|
boxStr,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
count, buttonLabels.get(),
|
count, count ? &buttonLabels[0] : nullptr,
|
||||||
1, wxRA_SPECIFY_COLS);
|
1, wxRA_SPECIFY_COLS);
|
||||||
mRadioBox->SetName(boxMsg);
|
mRadioBox->SetName(boxStr);
|
||||||
mRadioBox->SetSelection(0);
|
mRadioBox->SetSelection(0);
|
||||||
vSizer->Add(mRadioBox, 1, wxEXPAND | wxALL, 5);
|
vSizer->Add(mRadioBox, 1, wxEXPAND | wxALL, 5);
|
||||||
|
|
||||||
@ -160,7 +159,8 @@ void MultiDialog::OnShowLog(wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
int ShowMultiDialog(const wxString &message,
|
int ShowMultiDialog(const wxString &message,
|
||||||
const TranslatableString &title,
|
const TranslatableString &title,
|
||||||
const wxChar **buttons, const wxString &boxMsg, bool log)
|
const TranslatableStrings &buttons,
|
||||||
|
const TranslatableString &boxMsg, bool log)
|
||||||
{
|
{
|
||||||
wxWindow * pParent = wxTheApp->GetTopWindow();
|
wxWindow * pParent = wxTheApp->GetTopWindow();
|
||||||
|
|
||||||
@ -189,7 +189,8 @@ int ShowMultiDialog(const wxString &message,
|
|||||||
return dlog.ShowModal();
|
return dlog.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxString &DefaultMultiDialogMessage()
|
const TranslatableString &DefaultMultiDialogMessage()
|
||||||
{
|
{
|
||||||
return _("Please select an action");
|
static auto result = XO("Please select an action");
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -17,17 +17,18 @@
|
|||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
|
|
||||||
#include <wx/chartype.h> // for typedef wxChar
|
#include <wx/chartype.h> // for typedef wxChar
|
||||||
class TranslatableString;
|
#include "../Internat.h" // for TranslatableStrings
|
||||||
class wxString;
|
class wxString;
|
||||||
|
|
||||||
const wxString &DefaultMultiDialogMessage();
|
const TranslatableString &DefaultMultiDialogMessage();
|
||||||
|
|
||||||
// Display a dialog with radio buttons.
|
// Display a dialog with radio buttons.
|
||||||
// Return the zero-based index of the chosen button.
|
// Return the zero-based index of the chosen button.
|
||||||
int ShowMultiDialog(const wxString &message,
|
int ShowMultiDialog(const wxString &message,
|
||||||
const TranslatableString &title,
|
const TranslatableString &title,
|
||||||
const wxChar **buttons,
|
const TranslatableStrings &buttons,
|
||||||
const wxString &boxMsg = DefaultMultiDialogMessage(),
|
const TranslatableString &boxMsg
|
||||||
|
= DefaultMultiDialogMessage(),
|
||||||
bool log = true);
|
bool log = true);
|
||||||
|
|
||||||
#endif // __AUDACITY_MULTIDIALOG__
|
#endif // __AUDACITY_MULTIDIALOG__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user