1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-25 08:58:06 +02:00

Translated effect name and description in many places in Effect.cpp...

... including titles of dialogs,
messages,
About sub-menu of the Manage button,
long-form names of Undo items (in history view),
message for why command is not allowed when there is no selection

Also one place in Effect Rack code but it's commented out
This commit is contained in:
Paul Licameli 2017-09-06 23:35:54 -04:00
parent 42f8945812
commit 5f298accbd
7 changed files with 54 additions and 14 deletions

View File

@ -59,6 +59,10 @@ public:
virtual wxString GetVendor() = 0;
virtual wxString GetVersion() = 0;
virtual wxString GetDescription() = 0;
// non-virtual convenience functions
const wxString& GetTranslatedName();
const wxString& GetTranslatedDescription();
};
#endif // __AUDACITY_IDENTINTERFACE_H__

View File

@ -2972,3 +2972,15 @@ int PluginManager::b64decode(const wxString &in, void *out)
return p - (unsigned char *) out;
}
// These are defined out-of-line here, to keep IdentInterface free of other
// #include directives.
const wxString& IdentInterface::GetTranslatedName()
{
return wxGetTranslation( GetName() );
}
const wxString& IdentInterface::GetTranslatedDescription()
{
return wxGetTranslation( GetDescription() );
}

View File

@ -1050,10 +1050,10 @@ bool Effect::SetAutomationParameters(const wxString & parms)
if (!success)
{
wxMessageBox(
Effect::MessageBox(
wxString::Format(
_("%s: Could not load settings below. Default settings will be used.\n\n%s"),
GetName().c_str(),
GetTranslatedName().c_str(),
preset.c_str()
)
);
@ -1215,9 +1215,10 @@ bool Effect::DoEffect(wxWindow *parent,
bool skipFlag = CheckWhetherSkipEffect();
if (skipFlag == false)
{
auto name = GetTranslatedName();
ProgressDialog progress{
GetName(),
wxString::Format(_("Applying %s..."), GetName().c_str()),
name,
wxString::Format(_("Applying %s..."), name.c_str()),
pdlgHideStopButton
};
auto vr = valueRestorer( mProgress, &progress );
@ -2563,7 +2564,7 @@ void Effect::Preview(bool dryOnly)
// Apply effect
if (!dryOnly) {
ProgressDialog progress{
GetName(),
GetTranslatedName(),
_("Preparing preview"),
pdlgHideCancelButton
}; // Have only "Stop" button.
@ -2608,7 +2609,7 @@ void Effect::Preview(bool dryOnly)
// The progress dialog blocks these events.
{
ProgressDialog progress
(GetName(), _("Previewing"), pdlgHideCancelButton);
(GetTranslatedName(), _("Previewing"), pdlgHideCancelButton);
while (gAudioIO->IsStreamActive(token) && previewing == ProgressResult::Success) {
::wxMilliSleep(100);
@ -2630,6 +2631,17 @@ void Effect::Preview(bool dryOnly)
}
}
int Effect::MessageBox
(const wxString& message, long style, const wxString &titleStr)
{
wxString title;
if (titleStr.empty())
title = GetTranslatedName();
else
title = wxString::Format(_("%s: %s"), GetTranslatedName(), titleStr);
return wxMessageBox(message, title, style, mUIParent);
}
BEGIN_EVENT_TABLE(EffectDialog, wxDialogWrapper)
EVT_BUTTON(wxID_OK, EffectDialog::OnOk)
END_EVENT_TABLE()
@ -2807,7 +2819,7 @@ END_EVENT_TABLE()
EffectUIHost::EffectUIHost(wxWindow *parent,
Effect *effect,
EffectUIClientInterface *client)
: wxDialogWrapper(parent, wxID_ANY, effect->GetName(),
: wxDialogWrapper(parent, wxID_ANY, effect->GetTranslatedName(),
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX)
{
@ -2816,7 +2828,7 @@ EffectUIHost::EffectUIHost(wxWindow *parent,
[[((NSView *)GetHandle()) window] setLevel:NSFloatingWindowLevel];
#endif
SetName(effect->GetName());
SetName( effect->GetTranslatedName() );
SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
mParent = parent;
@ -3177,7 +3189,7 @@ void EffectUIHost::OnApply(wxCommandEvent & evt)
{
auto flags = AlwaysEnabledFlag;
bool allowed = mProject->ReportIfActionNotAllowed(
mEffect->GetName(),
mEffect->GetTranslatedName(),
flags,
WaveTracksSelectedFlag | TimeSelectedFlag,
WaveTracksSelectedFlag | TimeSelectedFlag);
@ -3335,10 +3347,10 @@ void EffectUIHost::OnMenu(wxCommandEvent & WXUNUSED(evt))
auto sub = std::make_unique<wxMenu>();
sub->Append(kDummyID, wxString::Format(_("Type: %s"), mEffect->GetFamily().c_str()));
sub->Append(kDummyID, wxString::Format(_("Name: %s"), mEffect->GetName().c_str()));
sub->Append(kDummyID, wxString::Format(_("Name: %s"), mEffect->GetTranslatedName().c_str()));
sub->Append(kDummyID, wxString::Format(_("Version: %s"), mEffect->GetVersion().c_str()));
sub->Append(kDummyID, wxString::Format(_("Vendor: %s"), mEffect->GetVendor().c_str()));
sub->Append(kDummyID, wxString::Format(_("Description: %s"), mEffect->GetDescription().c_str()));
sub->Append(kDummyID, wxString::Format(_("Description: %s"), mEffect->GetTranslatedDescription().c_str()));
menu.Append(0, _("About"), sub.release());
}

View File

@ -261,6 +261,15 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
/* not virtual */ bool IsRealtimeActive();
virtual bool IsHidden();
// Nonvirtual
// Display a message box, using effect's (translated) name as the prefix
// for the title.
enum : long { DefaultMessageBoxStyle = wxOK | wxCENTRE };
int MessageBox(const wxString& message,
long style = DefaultMessageBoxStyle,
const wxString& titleStr = wxString{});
//
// protected virtual methods
//
@ -268,6 +277,7 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
// do its processing.
//
protected:
// Called once each time an effect is called. Perform any initialization;
// make sure that the effect can be performed on the selected tracks and
// return false otherwise

View File

@ -149,7 +149,7 @@ wxString EffectManager::GetEffectDescription(const PluginID & ID)
if (effect)
{
return wxString::Format(_("Applied effect: %s"), effect->GetName().c_str());
return wxString::Format(_("Applied effect: %s"), GetEffectName(ID).c_str());
}
return wxEmptyString;

View File

@ -248,7 +248,8 @@ void EffectRack::Add(Effect *effect, bool active, bool favorite)
bb->SetToolTip(_("Remove effect from the rack"));
mMainSizer->Add(bb, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
wxStaticText *text = safenew wxStaticText(mPanel, ID_NAME + mNumEffects, effect->GetName());
wxStaticText *text = safenew wxStaticText(mPanel, ID_NAME + mNumEffects,
effect->GetTranslatedName() );
text->SetToolTip(_("Name of the effect"));
mMainSizer->Add(text, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5);

View File

@ -892,7 +892,8 @@ wxString AudioUnitEffect::GetVersion()
wxString AudioUnitEffect::GetDescription()
{
return wxT("N/A");
/* i18n-hint: Can mean "not available," "not applicable," "no answer" */
return XO("n/a");
}
// ============================================================================