using Nop.Core.Infrastructure; using Nop.Services.Localization; using Nop.Web.Framework.Localization; namespace Nop.Web.Framework.Mvc.Razor; /// /// Web view page /// /// Model public abstract partial class NopRazorPage : Microsoft.AspNetCore.Mvc.Razor.RazorPage { protected ILocalizationService _localizationService; protected Localizer _localizer; /// /// Get a localized resources /// public Localizer T { get { _localizationService ??= EngineContext.Current.Resolve(); _localizer ??= (format, args) => { var resFormat = _localizationService.GetResourceAsync(format).Result; if (string.IsNullOrEmpty(resFormat)) { return new LocalizedString(format); } return new LocalizedString((args == null || args.Length == 0) ? resFormat : string.Format(resFormat, args)); }; return _localizer; } } } /// /// Web view page /// /// TODO: Doesn't seem to be used anywhere public abstract partial class NopRazorPage : NopRazorPage { }