diff --git a/src/Menus.cpp b/src/Menus.cpp index 5383710e9..f78aeff4b 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -171,8 +171,8 @@ enum { WX_DEFINE_ARRAY_PTR(const PluginDescriptor *, EffectPlugs); static int SortEffectsByName(const PluginDescriptor **a, const PluginDescriptor **b) { - wxString akey = (*a)->GetName(); - wxString bkey = (*b)->GetName(); + wxString akey = (*a)->GetTranslatedName(); + wxString bkey = (*b)->GetTranslatedName(); akey += (*a)->GetPath(); bkey += (*b)->GetPath(); @@ -182,8 +182,8 @@ static int SortEffectsByName(const PluginDescriptor **a, const PluginDescriptor static int SortEffectsByPublisher(const PluginDescriptor **a, const PluginDescriptor **b) { - wxString akey = (*a)->GetVendor(); - wxString bkey = (*b)->GetVendor(); + wxString akey = (*a)->GetTranslatedVendor(); + wxString bkey = (*b)->GetTranslatedVendor(); if (akey.IsEmpty()) { @@ -194,8 +194,8 @@ static int SortEffectsByPublisher(const PluginDescriptor **a, const PluginDescri bkey = _("Uncategorized"); } - akey += (*a)->GetName(); - bkey += (*b)->GetName(); + akey += (*a)->GetTranslatedName(); + bkey += (*b)->GetTranslatedName(); akey += (*a)->GetPath(); bkey += (*b)->GetPath(); @@ -205,8 +205,8 @@ static int SortEffectsByPublisher(const PluginDescriptor **a, const PluginDescri static int SortEffectsByPublisherAndName(const PluginDescriptor **a, const PluginDescriptor **b) { - wxString akey = (*a)->GetVendor(); - wxString bkey = (*b)->GetVendor(); + wxString akey = (*a)->GetTranslatedVendor(); + wxString bkey = (*b)->GetTranslatedVendor(); if ((*a)->IsEffectDefault()) { @@ -217,8 +217,8 @@ static int SortEffectsByPublisherAndName(const PluginDescriptor **a, const Plugi bkey = wxEmptyString; } - akey += (*a)->GetName(); - bkey += (*b)->GetName(); + akey += (*a)->GetTranslatedName(); + bkey += (*b)->GetTranslatedName(); akey += (*a)->GetPath(); bkey += (*b)->GetPath(); @@ -228,8 +228,8 @@ static int SortEffectsByPublisherAndName(const PluginDescriptor **a, const Plugi static int SortEffectsByTypeAndName(const PluginDescriptor **a, const PluginDescriptor **b) { - wxString akey = (*a)->GetEffectFamily(); - wxString bkey = (*b)->GetEffectFamily(); + wxString akey = (*a)->GetTranslatedEffectFamily(); + wxString bkey = (*b)->GetTranslatedEffectFamily(); if (akey.IsEmpty()) { @@ -249,8 +249,8 @@ static int SortEffectsByTypeAndName(const PluginDescriptor **a, const PluginDesc bkey = wxEmptyString; } - akey += (*a)->GetName(); - bkey += (*b)->GetName(); + akey += (*a)->GetTranslatedName(); + bkey += (*b)->GetTranslatedName(); akey += (*a)->GetPath(); bkey += (*b)->GetPath(); @@ -260,8 +260,8 @@ static int SortEffectsByTypeAndName(const PluginDescriptor **a, const PluginDesc static int SortEffectsByType(const PluginDescriptor **a, const PluginDescriptor **b) { - wxString akey = (*a)->GetEffectFamily(); - wxString bkey = (*b)->GetEffectFamily(); + wxString akey = (*a)->GetTranslatedEffectFamily(); + wxString bkey = (*b)->GetTranslatedEffectFamily(); if (akey.IsEmpty()) { @@ -272,8 +272,8 @@ static int SortEffectsByType(const PluginDescriptor **a, const PluginDescriptor bkey = _("Uncategorized"); } - akey += (*a)->GetName(); - bkey += (*b)->GetName(); + akey += (*a)->GetTranslatedName(); + bkey += (*b)->GetTranslatedName(); akey += (*a)->GetPath(); bkey += (*b)->GetPath(); @@ -1711,7 +1711,7 @@ void AudacityProject::AddEffectMenuItems(CommandManager *c, { const PluginDescriptor *plug = plugs[i]; - wxString name = plug->GetName(); + wxString name = plug->GetTranslatedName(); if (plug->IsEffectInteractive()) { @@ -1720,7 +1720,7 @@ void AudacityProject::AddEffectMenuItems(CommandManager *c, if (groupBy == wxT("groupby:publisher")) { - current = plug->GetVendor(); + current = plug->GetTranslatedVendor(); if (current.IsEmpty()) { current = _("Unknown"); @@ -1728,7 +1728,7 @@ void AudacityProject::AddEffectMenuItems(CommandManager *c, } else if (groupBy == wxT("groupby:type")) { - current = plug->GetEffectFamily(); + current = plug->GetTranslatedEffectFamily(); if (current.IsEmpty()) { current = _("Unknown"); @@ -1775,7 +1775,7 @@ void AudacityProject::AddEffectMenuItems(CommandManager *c, { const PluginDescriptor *plug = plugs[i]; - wxString name = plug->GetName(); + wxString name = plug->GetTranslatedName(); if (plug->IsEffectInteractive()) { @@ -1785,11 +1785,11 @@ void AudacityProject::AddEffectMenuItems(CommandManager *c, wxString group = wxEmptyString; if (groupBy == wxT("sortby:publisher:name")) { - group = plug->GetVendor(); + group = plug->GetTranslatedVendor(); } else if (groupBy == wxT("sortby:type:name")) { - group = plug->GetEffectFamily(); + group = plug->GetTranslatedEffectFamily(); } if (plug->IsEffectDefault()) diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index 7f93b4642..ccb5435e5 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -628,7 +628,7 @@ void PluginRegistrationDialog::PopulateOrExchange(ShuttleGui &S) if (plugType == PluginTypeEffect) { - item.name = plug.GetName(); + item.name = plug.GetTranslatedName(); } // This is not right and will not work when other plugin types are added. // But it's presumed that the plugin manager dialog will be fully developed @@ -1145,9 +1145,9 @@ const wxString & PluginDescriptor::GetSymbol() const return mSymbol; } -wxString PluginDescriptor::GetName(bool translate) const +wxString PluginDescriptor::GetUntranslatedName() const { - return translate ? wxString(wxGetTranslation(mName)) : mName; + return mName; } wxString PluginDescriptor::GetUntranslatedVersion() const @@ -1155,9 +1155,19 @@ wxString PluginDescriptor::GetUntranslatedVersion() const return mVersion; } -wxString PluginDescriptor::GetVendor(bool translate) const +wxString PluginDescriptor::GetTranslatedName() const { - return translate ? wxString(wxGetTranslation(mVendor)) : mVendor; + return wxGetTranslation(mName); +} + +wxString PluginDescriptor::GetUntranslatedVendor() const +{ + return mVendor; +} + +wxString PluginDescriptor::GetTranslatedVendor() const +{ + return wxGetTranslation(mVendor); } bool PluginDescriptor::IsEnabled() const @@ -1222,9 +1232,14 @@ void PluginDescriptor::SetValid(bool valid) // Effects -wxString PluginDescriptor::GetEffectFamily(bool translate) const +wxString PluginDescriptor::GetUntranslatedEffectFamily() const { - return translate ? wxString(wxGetTranslation(mEffectFamily)) : mEffectFamily; + return mEffectFamily; +} + +wxString PluginDescriptor::GetTranslatedEffectFamily() const +{ + return wxGetTranslation(mEffectFamily); } EffectType PluginDescriptor::GetEffectType() const @@ -1987,7 +2002,7 @@ void PluginManager::LoadGroup(wxFileConfig *pRegistry, PluginType type) // Get the symbol...use name if not found if (!pRegistry->Read(KEY_SYMBOL, &strVal)) { - strVal = plug.GetName(); + strVal = plug.GetTranslatedName(); } plug.SetSymbol(strVal); @@ -2205,9 +2220,9 @@ void PluginManager::SaveGroup(wxFileConfig *pRegistry, PluginType type) pRegistry->Write(KEY_PATH, plug.GetPath()); pRegistry->Write(KEY_SYMBOL, plug.GetSymbol()); - pRegistry->Write(KEY_NAME, plug.GetName(false)); + pRegistry->Write(KEY_NAME, plug.GetUntranslatedName()); pRegistry->Write(KEY_VERSION, plug.GetUntranslatedVersion()); - pRegistry->Write(KEY_VENDOR, plug.GetVendor(false)); + pRegistry->Write(KEY_VENDOR, plug.GetUntranslatedVendor()); // Write a blank -- see comments in LoadGroup: pRegistry->Write(KEY_DESCRIPTION, wxString{}); pRegistry->Write(KEY_PROVIDERID, plug.GetProviderID()); @@ -2244,7 +2259,7 @@ void PluginManager::SaveGroup(wxFileConfig *pRegistry, PluginType type) stype = KEY_EFFECTTYPE_HIDDEN; } pRegistry->Write(KEY_EFFECTTYPE, stype); - pRegistry->Write(KEY_EFFECTFAMILY, plug.GetEffectFamily(false)); + pRegistry->Write(KEY_EFFECTFAMILY, plug.GetUntranslatedEffectFamily()); pRegistry->Write(KEY_EFFECTDEFAULT, plug.IsEffectDefault()); pRegistry->Write(KEY_EFFECTINTERACTIVE, plug.IsEffectInteractive()); pRegistry->Write(KEY_EFFECTREALTIME, plug.IsEffectRealtime()); @@ -2442,7 +2457,7 @@ const PluginDescriptor *PluginManager::GetFirstPlugin(PluginType type) bool familyEnabled = true; if (type == PluginTypeEffect) { - gPrefs->Read(plug.GetEffectFamily() + wxT("/Enable"), &familyEnabled, true); + gPrefs->Read(plug.GetTranslatedEffectFamily() + wxT("/Enable"), &familyEnabled, true); } if (plug.IsValid() && plug.IsEnabled() && plug.GetPluginType() == type && familyEnabled) { @@ -2461,7 +2476,7 @@ const PluginDescriptor *PluginManager::GetNextPlugin(PluginType type) bool familyEnabled = true; if (type == PluginTypeEffect) { - gPrefs->Read(plug.GetEffectFamily() + wxT("/Enable"), &familyEnabled, true); + gPrefs->Read(plug.GetTranslatedEffectFamily() + wxT("/Enable"), &familyEnabled, true); } if (plug.IsValid() && plug.IsEnabled() && plug.GetPluginType() == type && familyEnabled) { @@ -2481,7 +2496,7 @@ const PluginDescriptor *PluginManager::GetFirstPluginForEffectType(EffectType ty PluginDescriptor & plug = mPluginsIter->second; bool familyEnabled; - gPrefs->Read(plug.GetEffectFamily(false) + wxT("/Enable"), &familyEnabled, true); + gPrefs->Read(plug.GetUntranslatedEffectFamily() + wxT("/Enable"), &familyEnabled, true); if (plug.IsValid() && plug.IsEnabled() && plug.GetEffectType() == type && familyEnabled) { if (plug.IsInstantiated() && em.IsHidden(plug.GetID())) @@ -2504,7 +2519,7 @@ const PluginDescriptor *PluginManager::GetNextPluginForEffectType(EffectType typ { PluginDescriptor & plug = mPluginsIter->second; bool familyEnabled; - gPrefs->Read(plug.GetEffectFamily() + wxT("/Enable"), &familyEnabled, true); + gPrefs->Read(plug.GetTranslatedEffectFamily() + wxT("/Enable"), &familyEnabled, true); if (plug.IsValid() && plug.IsEnabled() && plug.GetEffectType() == type && familyEnabled) { if (plug.IsInstantiated() && em.IsHidden(plug.GetID())) @@ -2557,7 +2572,7 @@ wxString PluginManager::GetName(const PluginID & ID) return wxEmptyString; } - return mPlugins[ID].GetName(); + return mPlugins[ID].GetTranslatedName(); } IdentInterface *PluginManager::GetInstance(const PluginID & ID) @@ -2893,9 +2908,9 @@ wxString PluginManager::SettingsPath(const PluginID & ID, bool shared) wxString id = GetPluginTypeString(plug.GetPluginType()) + wxT("_") + - plug.GetEffectFamily(false) + // is empty for non-Effects + plug.GetUntranslatedEffectFamily() + // is empty for non-Effects wxT("_") + - plug.GetVendor(false) + + plug.GetUntranslatedVendor() + wxT("_") + (shared ? wxT("") : plug.GetSymbol()); diff --git a/src/PluginManager.h b/src/PluginManager.h index f223b6bf7..1f6e4dc04 100644 --- a/src/PluginManager.h +++ b/src/PluginManager.h @@ -63,10 +63,13 @@ public: const wxString & GetSymbol() const; wxString GetUntranslatedVersion() const; + // There is no translated version - // These return translated strings (if available and if requested) - wxString GetName(bool translate = true) const; - wxString GetVendor(bool translate = true) const; + wxString GetUntranslatedName() const; + wxString GetTranslatedName() const; + + wxString GetUntranslatedVendor() const; + wxString GetTranslatedVendor() const; bool IsEnabled() const; bool IsValid() const; @@ -87,8 +90,8 @@ public: // Effect plugins only - // Will return an untranslated string - wxString GetEffectFamily(bool translate = true) const; + wxString GetUntranslatedEffectFamily() const; + wxString GetTranslatedEffectFamily() const; EffectType GetEffectType() const; bool IsEffectDefault() const; bool IsEffectInteractive() const;