I sometimes have to use IPageRetriever outside my site's current context. I am able to get and set the expected culture so that LocalizationContext.CurrentCulture.CultureCode; returns the correct value.
LocalizationContext.CurrentCulture.CultureCode;
However, IPageRetriever still reverts back to the default culture so I'm guessing it doesn't rely on LocalizationContext.CurrentCulture? If not, is there anything else I can set in my middleware to ensure the correct culture/context?
Or do I always have to use .Culture(currentCultureCode).CombineWithDefaultCulture(false) on my IPageRetriever methods?
.Culture(currentCultureCode).CombineWithDefaultCulture(false)
Thanks,
Rory
IPageRetriever gets the culture from the current context - which is usually set by the Thread.CurrentThread.CurrentCulture property
IPageRetriever
Thread.CurrentThread.CurrentCulture
That did the trick. Many thanks Juraj!
Please, sign in to be able to submit a new answer.