views:

92

answers:

2

Hello,

I am facing a problem. I would like to localize my action names in my project so french people can have clean urls with french names.

http://www.test.com/Home should be http://www.test.com/Accueil

It is a good thing too for google indexing. Moreover I would like to be Restful on the application, so I would like too keep english name because developers (even frenchies) prefer to work on english names.

I don't know if it's possible and how.

My first idea should be something like get the browser language, assign it to the CurrentThread.CurrentCulture, so I can select the view name I want.

Thank you very much for your answers.

+4  A: 

you can do this when you register the routes in global.asax.

if normally you have this:

routes.MapRoute("Catalog-Brands", "catalog/brand/", new {controller = "Brand", action = "Index", isActive = true});

you could make this one too (I don't know french, sorry)

routes.MapRoute("Catalog-Brands-French", "french-catalog/french-brand/", new {controller = "Brand", action = "Index", isActive = true});

you could either make them all available globally or have separate:

public static void RegisterUsRoutes

public static void RegisterFrenchRoutes

you'd have to make the decision at application startup though (you may or may not be able to register routes at runtime.)

Kyle West
+2  A: 

If you can use ISAPIs, that is to say, if you control IIS, the best thing is to use a ISAPI I recommend you Ionics Isapi: http://www.codeplex.com/IIRF

It implements more or less what Rewrite mod in Apache does (redirections).

netadictos