using Nop.Core.Domain.Localization; using Nop.Core.Infrastructure; using Nop.Data; using Nop.Web.Framework.Mvc.Routing; namespace Nop.Web.Infrastructure; /// /// Represents base provider /// public partial class BaseRouteProvider { /// /// Get pattern used to detect routes with language code /// /// protected string GetLanguageRoutePattern() { if (DataSettingsManager.IsDatabaseInstalled()) { var localizationSettings = EngineContext.Current.Resolve(); if (localizationSettings.SeoFriendlyUrlsForLanguagesEnabled) { //this pattern is set once at the application start, when we don't have the selected language yet //so we use 'en' by default for the language value, later it'll be replaced with the working language code var code = "en"; return $"{{{NopRoutingDefaults.RouteValue.Language}:maxlength(2):{NopRoutingDefaults.LanguageParameterTransformer}={code}}}"; } } return string.Empty; } }