Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V13: Set request culture for VirtualPageController #16572

Merged

Conversation

nikolajlauridsen
Copy link
Contributor

Fixes #16555.

Following #16218 VirtualPageController requests no longer hit the UmbracoRouteValueTransformer. This had the side effect that the request culture was no longer properly set in the VariationContext and PublishedRequest.

To fix this I've:

  • Split FindDomain into FindDomain and FindAndSetDomain
  • This allowed me to create two new methods: RouteDomain and UpdateVariationContext
  • Call UpdateVariationContext before FindContent is invoked, ensuring that the variation context is correctly configured for finding the content
  • Call FindDomain to ensure the PublishedRequest and VariationContext have the correct cultures configured.

Testing

Configure a virtual page controller like in the issue, and ensure that the culture specified in the domains is set correctly. You can check it like so:

IVariationContextAccessor variationContextAccessor =
        context.HttpContext.RequestServices.GetRequiredService<IVariationContextAccessor>();
var culture = variationContextAccessor.VariationContext?.Culture;

@Zeegaan
Copy link
Member

Zeegaan commented Jun 7, 2024

Looks good, tests good 🚀

@Zeegaan Zeegaan merged commit 5ae5fe3 into v13/dev Jun 7, 2024
15 of 16 checks passed
@Zeegaan Zeegaan deleted the v13/fix/set-request-culture-for-virtualpagecontroller branch June 7, 2024 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants