Not sure if relevant but I recall with Umbraco v6 surfacecontrollers when making ajax calls the language context was being lost so i had to do the following:
protected void SetCultureForAjax()
{
//we lose culture and dictionary wont get labels therefore set it on the thread
string code = _umbracoService.GetCultureCode();
//Get the culture info of the language code
CultureInfo culture = CultureInfo.CreateSpecificCulture(code);
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
}
The GetCultureCode is getting the culture set on current node. So you could maybe do something similar?
UmbracoApiController wrong language
Hi,
How do I set the language of the dictionaryhelper? The whole site is Dutch.
With the Views, RenderMvcController and SurfaceController the method: DictionaryHelper.Translate gave the Dutch item from the dictionary.
If I use the same method on a UmbracoApiController, The English item from the dictionary is returned.
Why?
Greets Jan
Hi Jan,
Have you set the culture of the website to be Dutch?
You can do this by right-clicking on your website root (the top level node not the "Content" node) and selecting the "Culture and Hostnames" option.
From there you select the culture "nl-nl" should be one of the options.
Thanks,
Jamie
Yes, Therefore I find it so strange the api is english.
Hi Jan,
did you find the solution to this issue? Would be great to know how you solved it.
Guys,
Not sure if relevant but I recall with Umbraco v6 surfacecontrollers when making ajax calls the language context was being lost so i had to do the following:
The GetCultureCode is getting the culture set on current node. So you could maybe do something similar?
Thanks for this - I will give it a try.
For the moment though I am lucky enough to only want 1 timezone - so I currently do this to get the local time:
is working on a reply...