public static string GenerateCarousel(this IContentLocalizer localizer, string name, Dictionary <string, string> filters) { if (localizer is null) { throw new ArgumentNullException(nameof(localizer)); } var carousel = localizer[name]; if (!(carousel?.Length > 0)) { return(""); } var carouselItems = new List <string>(); var carouselType = _attributesRegex.Match(carousel).Value; foreach (Match bannerName in _bannerRegex.Matches(carousel)) { bool?skip = null; var banner = localizer[bannerName.Value]; foreach (Match setName in _datasetRegex.Matches(banner)) { var dataSet = localizer[setName.Value]; var set = dataSet.Split(':')[0]; var values = dataSet.Split(':')[1].Split(',').ToArray(); if (filters != null && filters.ContainsKey(set) && filters[set] != null && skip != false) { skip = values.FirstOrDefault(x => x == filters[set]) == null; } } if (skip == true) { continue; } carouselItems.Add(banner); } return(MergeCarouselContents(name, carouselType, carouselItems)); }
internal LocalizerContainer(IContentLocalizer contentLocalizer, ContentUpdater updater) { _contentLocalizer = contentLocalizer; _updater = updater; }