Localization of controller action names
I have a problem. I would like to localize the names of my actions in my project so that French people can have clean URLs with French names.
http://www.test.com/Home should be http://www.test.com/Accueil
This is good for google indexing too. Also, I would like to be Restful in the application, so I would like to keep the English name as well, because the developers (even the French) prefer to work on English names.
I don't know if this is possible and how.
My first idea should be something like getting the browser language, assign it to CurrentThread.CurrentCulture, so I can pick the view name I want.
Thanks a lot for your answers.
source to share
you can do this when you register routes in global.asax.
if you have this:
routes.MapRoute("Catalog-Brands", "catalog/brand/", new {controller = "Brand", action = "Index", isActive = true});
you can do that too (i don't know french, sorry)
routes.MapRoute("Catalog-Brands-French", "french-catalog/french-brand/", new {controller = "Brand", action = "Index", isActive = true});
you can either make them globally available or have a separate file:
public static void RegisterUsRoutes
public static void RegisterFrenchRoutes
you will need to make a decision when the application starts, though (you may or may not be able to register routes at runtime.)
source to share
If you can use ISAPI, that is, if you are in control of IIS, your best bet is to use ISAPI. I recommend Ionics Isapi to you: http://www.codeplex.com/IIRF
It implements more or less what the Rewrite mod in Apache does (redirects).
source to share