using System; using System.Collections.Concurrent; using System.Threading; namespace Umbraco.Cms.Core.Models.PublishedContent { /// /// Provides a CurrentUICulture-based implementation of . /// /// /// This accessor does not support segments. There is no need to set the current context. /// public class ThreadCultureVariationContextAccessor : IVariationContextAccessor { private readonly ConcurrentDictionary _contexts = new ConcurrentDictionary(); public VariationContext? VariationContext { get => _contexts.GetOrAdd(Thread.CurrentThread.CurrentUICulture.Name, culture => new VariationContext(culture)); set => throw new NotSupportedException(); } } }