0

I would like to know if there is some way to using Html.ActionLink to set in which language has to be generated the URL of link using AttributeRouting. I have tried with:

Html.ActionLink("DescriptionLinkText", "Controller", "Action",
                new { language="en" }, null)

but it doesn't work. Is there a way to set to AttributeRouting in which language has to be generated the URL.

What I need is to put at the top of my website links to change the current language. For example if the user is at /en/contact and click on links to change to spanish I want the same page was reloaded but in spanish language /es/contacto instead of redirecting to home page, for this reason I need to generate URL's in different culture of CurrentCulture to allow to change language and continue to the same page.

Thanks for your help

Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
Marc Cals
  • 2,963
  • 4
  • 30
  • 48

1 Answers1

0

Why don't you use resources for localization?

@Html.ActionLink(LocalizedResources.ActionLinkLabel, "Action", "Controller")

update:

@Html.ActionLink(LocalizedResources.ActionLinkLabel, LocalizedResources.Action, LocalizedResources.Controller)
Sergio
  • 6,900
  • 5
  • 31
  • 55