Created
July 6, 2015 09:14
-
-
Save rasmusfjord/070558245ae4ef91ec11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @inherits Umbraco.Web.Mvc.UmbracoViewPage<Umbraco.Core.Models.IPublishedContent> | |
| <p>@Umbraco.GetDictionaryValue("Værelse")</p> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class BookingController : SurfaceController | |
| { | |
| public ActionResult GetRoomMarkup(int id) | |
| { | |
| return PartialView("booking-rooms", Umbraco.TypedContent(id)); | |
| } | |
| } |
Author
Arh roger got it ! :D
Author
My solution ended up being like this :
View:
@Url.Action("GetRoomMarkup", "Booking", new { id = CurrentPage.Id, lang= Model.Content.GetCulture() })
Surfacecontroller Inheriter:
public class AjaxSurfaceController : SurfaceController
{
protected void SetCultureForAjax(string lang)
{
//Get the culture info of the language code
CultureInfo culture = CultureInfo.CreateSpecificCulture(lang);
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
}
}
Surfacecontroller that inherites:
public class BookingController : AjaxSurfaceController
{
public ActionResult GetRoomMarkup(int id, string lang)
{
if (ControllerContext.HttpContext.Request.IsAjaxRequest())
{
SetCultureForAjax(lang);
}
return PartialView("booking-rooms", Umbraco.TypedContent(id));
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ignore the servicefactory and getculturecode bit you need to pass in the culture code you could get that from current node or its home page?