I'm creating a HtmlHelper extention that should create a set of links pointing to the current URL, but that have a different language code as their first parameter. The languagecodes are passed in as a list.
Currently I require the UrlHelper to be passed in and do the following:
/*Warning: HACK*/
RouteValueDictionary vals = html.ViewContext.RouteData.Values;
vals["siteLanguage"] = "replaceMe";
string siteLanUrl = url.RouteUrl(vals).Replace("replaceMe", "{0}");
/*ENDHACK*/
Then I do a string replace so the "{0}" can be replaced with the set of language codes I have.
This is off course but ugly for a multitude of reasons. But I don't know how else I can generate these urls from with the HtmlHelper. Any suggestions?