I have site culture in URLs like this:
routes.MapRoute(
\"Default\",
\"{language}/{controller}/{action}/{id}\",
languageDefaults,
languag
It should preserve all values defined in route and present in RouteData
automatically, unless you set it to something else. Try to create link without T4MVC or check your route definitions. Something like this works for me just fine:
routes.MapRoute("Default with language", "{lang}/{controller}/{action}/{id}", new
{
controller = "Home",
action = "Index",
id = UrlParameter.Optional,
}, new { lang = "de|fr" });
routes.MapRoute("Default", "{controller}/{action}/{id}", new
{
controller = "Home",
action = "Index",
id = UrlParameter.Optional,
lang = "en",
});
+
protected void Application_AcquireRequestState(object sender, EventArgs e)
{
MvcHandler handler = Context.Handler as MvcHandler;
if (handler == null)
return;
string lang = (string)handler.RequestContext.RouteData.Values["lang"];
CultureInfo culture = CultureInfo.GetCultureInfo(lang);
Thread.CurrentThread.CurrentUICulture = culture;
Thread.CurrentThread.CurrentCulture = culture;
}
+
<%: Html.ActionLink("About us", "Detail", "Articles", new { @type = ArticleType.About }, null) %>