Hello community
I’m triyng to get pages with the API using Umbraco.Content(xxxx).Children, but it always return the content in his default culture.
How can I specify the culture to get?
Here’s my code:
public JsonResult<List<Retailer>> GetAll()
{
var retailers = new List<Retailer>();
//This shit dosen't work
var lang = HttpContext.Current.Request.QueryString["lang"];
var cultureInfo = CultureInfo.GetCultureInfo(lang);
Thread.CurrentThread.CurrentCulture = cultureInfo;
Thread.CurrentThread.CurrentUICulture = cultureInfo;
//
foreach (dynamic child in Umbraco.Content(1159).Children)
{
retailers.Add(new Retailer() { Name = child.Name, Url = child.Url, City = child.Ville, Latitude = child.Latitude, Longitude = child.Longitude, Region = child.Region });
}
return Json(retailers, _settings);
}
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/98338-api-how-can-i-get-content-from-other-culture