From 90e9ad31b4b5cb0c6265db93c1932d901aaeccd4 Mon Sep 17 00:00:00 2001 From: Sergey Koshelev Date: Wed, 7 Dec 2022 17:04:17 +0300 Subject: [PATCH] #43 Fixed installation process --- src/Presentation/Nop.Web.Framework/UI/NopHtmlHelper.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Presentation/Nop.Web.Framework/UI/NopHtmlHelper.cs b/src/Presentation/Nop.Web.Framework/UI/NopHtmlHelper.cs index 5220d33e574..195e61ce556 100644 --- a/src/Presentation/Nop.Web.Framework/UI/NopHtmlHelper.cs +++ b/src/Presentation/Nop.Web.Framework/UI/NopHtmlHelper.cs @@ -40,7 +40,7 @@ public partial class NopHtmlHelper : INopHtmlHelper private readonly HtmlEncoder _htmlEncoder; private readonly IActionContextAccessor _actionContextAccessor; private readonly IAssetPipeline _assetPipeline; - private readonly ILocalizationService _localizationService; + private readonly Lazy _localizationService; private readonly IStoreContext _storeContext; private readonly IUrlHelperFactory _urlHelperFactory; private readonly IWebHostEnvironment _webHostEnvironment; @@ -68,7 +68,7 @@ public NopHtmlHelper(AppSettings appSettings, HtmlEncoder htmlEncoder, IActionContextAccessor actionContextAccessor, IAssetPipeline assetPipeline, - ILocalizationService localizationService, + Lazy localizationService, IStoreContext storeContext, IUrlHelperFactory urlHelperFactory, IWebHostEnvironment webHostEnvironment, @@ -211,7 +211,7 @@ public virtual async Task GenerateTitleAsync(bool addDefaultTitle { AppendTitleParts(part); var store = await _storeContext.GetCurrentStoreAsync(); - var defaultTitle = await _localizationService.GetLocalizedAsync(store, s => s.DefaultTitle); + var defaultTitle = await _localizationService.Value.GetLocalizedAsync(store, s => s.DefaultTitle); var specificTitle = string.Join(_seoSettings.PageTitleSeparator, _titleParts.AsEnumerable().Reverse().ToArray()); string result; @@ -281,7 +281,7 @@ public virtual async Task GenerateMetaDescriptionAsync(string part var metaDescription = string.Join(", ", _metaDescriptionParts.AsEnumerable().Reverse().ToArray()); var result = !string.IsNullOrEmpty(metaDescription) ? metaDescription - : await _localizationService.GetLocalizedAsync(await _storeContext.GetCurrentStoreAsync(), + : await _localizationService.Value.GetLocalizedAsync(await _storeContext.GetCurrentStoreAsync(), s => s.DefaultMetaDescription); return new HtmlString(_htmlEncoder.Encode(result ?? string.Empty)); @@ -324,7 +324,7 @@ public virtual async Task GenerateMetaKeywordsAsync(string part = var metaKeyword = string.Join(", ", _metaKeywordParts.AsEnumerable().Reverse().ToArray()); var result = !string.IsNullOrEmpty(metaKeyword) ? metaKeyword - : await _localizationService.GetLocalizedAsync(await _storeContext.GetCurrentStoreAsync(), + : await _localizationService.Value.GetLocalizedAsync(await _storeContext.GetCurrentStoreAsync(), s => s.DefaultMetaKeywords); return new HtmlString(_htmlEncoder.Encode(result ?? string.Empty));