diff options
author | Lluis Sanchez <llsan@microsoft.com> | 2018-07-03 18:10:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-03 18:10:56 +0300 |
commit | a543fa0011098232041c99bc5acb6416cb4acbe0 (patch) | |
tree | 221374ebcab6fcbfeef29b4c608fbdcafd317b93 | |
parent | 5b0e3b15aa398c89fe303510627e449af73c0180 (diff) | |
parent | bd1fd84b41f8aca518c184e007d70d4024eb0002 (diff) |
Merge pull request #120 from mono/addin-load-logging-avoid-addin-load-for-default-localizer
Avoid loading the addin if it has no localizer
-rw-r--r-- | Mono.Addins/Mono.Addins/ExtensionNode.cs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Mono.Addins/Mono.Addins/ExtensionNode.cs b/Mono.Addins/Mono.Addins/ExtensionNode.cs index 2dc7126..6baad49 100644 --- a/Mono.Addins/Mono.Addins/ExtensionNode.cs +++ b/Mono.Addins/Mono.Addins/ExtensionNode.cs @@ -412,7 +412,7 @@ namespace Mono.Addins if (memberType == typeof(string)) { if (f.Localizable) - val = Addin.Localizer.GetString (at.value); + val = GetAddinLocalizer ().GetString (at.value); else val = at.value; } @@ -449,6 +449,21 @@ namespace Mono.Addins } } } + + /// <summary> + /// Tries to avoid loading the addin dependencies when getting the localizer. + /// </summary> + AddinLocalizer GetAddinLocalizer () + { + if (addin != null || addinId == null) + return Addin.Localizer; + + Addin foundAddin = addinEngine.Registry.GetAddin (addinId); + if (foundAddin == null || foundAddin.Description.Localizer != null) + return Addin.Localizer; + + return addinEngine.DefaultLocalizer; + } internal bool NotifyChildChanged () { |