From 4628d6afa7a553a242f00ee8c1be0e72c5692052 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Tue, 16 Jan 2018 10:41:47 -0500 Subject: [PATCH] Remap effect type from "Audacity" to "Built-in", carefully... ... doing that only for the user-visible string, seen in the Manage>About menu of the effect dialog and in the sorted or grouped Effect/Generate/Analyze menus. But don't for the string used internally and written into pluginregistry.cfg, so that compatibility of that file is preserved. See also commits cafbff9ff82520ff7d4344570385752869c6d230 and c6bbe4c3dae8a52bb4b7a3c720af97bc3bd69769 --- src/PluginManager.cpp | 29 +++++++++++++++++++++++++++++ src/effects/Effect.cpp | 20 +++++++++++++++++++- src/effects/Effect.h | 2 +- 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index e96005cb7..76f041eb7 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -1243,7 +1243,36 @@ wxString PluginDescriptor::GetUntranslatedEffectFamily() const wxString PluginDescriptor::GetTranslatedEffectFamily() const { +#if 0 + return wxGetTranslation(mEffectFamily); + +#else + + // PRL: 2.2.2 hack to change the visible name without breaking + // compatibility of pluginregistry.cfg; redo this better + // Remap "Audacity" to "Built-in" (suitably translated) + + // "Audacity" was the only possibility for mEffectFamily that was in the + // message catalog. + // The other possibilites are "VST", "LADSPA", "AudioUnit", "Nyquist", + // "LV2", "Vamp" + // None of these strings (yet) occur anywhere in the program in _() or XO() + // And we will leave them verbatim in other locales, as proper names + + // See also EffectUIHost::OnMenu + + // See also commits cafbff9ff82520ff7d4344570385752869c6d230 and + // c6bbe4c3dae8a52bb4b7a3c720af97bc3bd69769 for more about the complications + // involving this function + + auto result = mEffectFamily; + if (result == wxT("Audacity")) + // Use XO so that this string does localize + result = XO("Built-in"); + return wxGetTranslation( result ); + +#endif } EffectType PluginDescriptor::GetEffectType() const diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 3a4b5a6e9..9f2d6f528 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -220,6 +220,15 @@ wxString Effect::GetFamily() return mClient->GetFamily(); } + // PRL: In 2.2.2 we wanted to change the user-visible name to + // "Built-in" but we did not do it the obvious way by just changing this + // string, because of problems with compatibility of pluginregistry.cfg + // See PluginDescriptor::GetTranslatedEffectFamily and + // EffectUIHost::OnMenu + // See PluginManager::RegisterPlugin and PluginManager::GetID, where the + // return value is also (mis?)used for internal identification purposes, + // NOT as a user-visible string! + // Thereby affecting configuration file contents! return XO("Audacity"); } @@ -3349,7 +3358,16 @@ void EffectUIHost::OnMenu(wxCommandEvent & WXUNUSED(evt)) { auto sub = std::make_unique(); - sub->Append(kDummyID, wxString::Format(_("Type: %s"), mEffect->GetFamily())); + auto type = mEffect->GetFamily(); + // PRL: 2.2.2 hack to change the visible name without breaking + // compatibility of pluginregistry.cfg; redo this better + // See also PluginDescriptor::GetTranslatedEffectFamily + if (type == wxT("Audacity")) + type = XO("Built-in"); + // And now, also, translate this (what 2.2.1 neglected) + type = wxGetTranslation(type); + + sub->Append(kDummyID, wxString::Format(_("Type: %s"), type)); sub->Append(kDummyID, wxString::Format(_("Name: %s"), mEffect->GetTranslatedName())); sub->Append(kDummyID, wxString::Format(_("Version: %s"), mEffect->GetVersion())); sub->Append(kDummyID, wxString::Format(_("Vendor: %s"), mEffect->GetVendor())); diff --git a/src/effects/Effect.h b/src/effects/Effect.h index 10806f76f..8a90614ec 100644 --- a/src/effects/Effect.h +++ b/src/effects/Effect.h @@ -88,7 +88,7 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler, // EffectIdentInterface implementation EffectType GetType() override; - wxString GetFamily() override; + wxString GetFamily() override; // returns UNTRANSLATED bool IsInteractive() override; bool IsDefault() override; bool IsLegacy() override;