Should I replace string patterns in asp.net mvc using a custom viewengine?

Posted by Roger Rogers on Stack Overflow See other posts from Stack Overflow or by Roger Rogers
Published on 2010-03-30T05:33:26Z Indexed on 2010/03/30 5:43 UTC
Read the original article Hit count: 352

Have an ASP.NET MVC site that is localized. The localization functionality adds the two digit language ID to the URL, e.g. /es/Page. If no language Id is found in the URL, the site switches to the user's browser culture. All's good. However, the site's hyperlinks, a mixture of hard-coded href tags, actionlinks, etc., don't include the base language ID, so when clicking through the site the set culture is lost, and the site reverts to the user's browser culture.

My (lazy) thought is to replace all href values, that don't point to an external site, with the localized URL (e.g. include the /es/). Otherwise, all site links will need to be updated to include the culture code.

Is this just plain dumb? Or, reasonable, and should be done using a custom view engine, or some other approach?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc-2