RadarBug
RadarBug

Reputation: 807

Culture for Umbraco API Controller

I can change the language for an Umbraco Surface Controller but I cannot see how to change it for an Umbraco API controller.

Even though I can change the culture in my global.ascx BeginRequest the Model is still trying to bind a date using en-US rather than en-UK.

I have also tried custom model binding but that does not seem to fire at all.

Upvotes: 0

Views: 2786

Answers (1)

Marko Jovanov
Marko Jovanov

Reputation: 418

Have you tried setting the CurrentUICulture, in you API Controller? Like this:

System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

I had a similar issue when trying to retrieve Umbraco.Context in regular Umbraco Controller.

Upvotes: 1

Related Questions