Web Api - Resolve current culture

Topics: General
Apr 20 at 1:50 PM
Hi,

I'm working on an AngularJS site that uses Orchard for content delivery. I'm exposing the Orchard content via a RESTful Web Api that the AngularJS site will consume.

The site will support multiple languages with a culture picker at the top of the page. Each of the content items within Orchard make use of the Localization Part so that we can allow for different content based on the users selected language.

What I'm struggling with, is being able to find the currently selected user culture within the web api method. I've tried using WorkContext.CurrentCulture, but it always returns the default culture for the site, and not the current user culture - and this, I believe, is due to the nature of the Web Api being completely stateless.

So currently I've resorted to passing the culture to the api method client-side by retrieving the html lang attribute value before making the appropriate api call.

I'm wondering if there are any better suggestions?