From 6b5e19fcf252568057cc063953f97e8bb678e258 Mon Sep 17 00:00:00 2001 From: Marc Goodson Date: Sun, 28 Jun 2020 18:08:03 +0100 Subject: [PATCH] Add the current culture to the cache key used for the CachedPartial Html Helper when using variants it's unlikely to need the same Html.Partial to be cached across all language variations, if we always add the current culture name to the cache key, we ensure this doesn't accidentally happen, and when not using variants, no harm to have the culture for the single site included here --- src/Umbraco.Web/HtmlHelperRenderExtensions.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs index 4b1de86bcf..e19ae883e9 100644 --- a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs +++ b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs @@ -83,6 +83,12 @@ namespace Umbraco.Web Func contextualKeyBuilder = null) { var cacheKey = new StringBuilder(partialViewName); + //let's always cache by the current culture to allow variants to have different cache results + var cultureName = System.Threading.Thread.CurrentThread.CurrentUICulture.Name; + if (!String.IsNullOrEmpty(cultureName)) + { + cacheKey.AppendFormat("{0}-", cultureName); + } if (cacheByPage) { if (Current.UmbracoContext == null)