I'm working with a client that wants the URLs in our web application to be in French. I'm an English developer and we also have English clients. This is an interesting problem but I don't think its something the ASP.NET MVC Framework would support.
Here's the scenario. The route...
Specific EXAMPLE
English URL
www.stackoverflow.com/questions/ask
would also support
French URL
www.stackoverflow.com/problème/poser
Generic EXAMPLE
English URL
http://clientA.product.com/AreaNameEnglish/ControllerNameEnglish/ActionNameEnglish/params
also needs to support
French URL
http://clientB.product.com/AreaNameFrench/ControllerNameFrench/ActionNameFrench/params
So in MVC my Area, Controller and Actions all need to have both English and French translations.
Obviously maintainability would be a HUGE issue if I were to go and hardcode all my Controllers, Views and Action names to French. Is there anyway to localize the route that is presented in the browser without doing this? Keeping in mind there are lots of different routes in the application. A couple Areas each with a handful of Controller each with many Actions?
Thanks,
Justin
EDIT
Thanks to @womp here is what I've come up with so far... Although in the end I took the approach which I posted as an answer.
public class LocalizedControllerFactory : DefaultControllerFactory
{
public override IController CreateController(RequestContext requestContext, string controllerName)
{
if (string.IsNullOrEmpty(controllerName))
throw new ArgumentNullException("controllerName");
if (CultureInfo.CurrentCulture.TwoL