You cannot have multiple names for the same action. These will be different actions. This is how mvc works. Mabe is better at implementing the described routing behavior.
routes.MapRoute("Lang1RouteToController1Action1", "Lang1Controller/Lang1Action/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); routes.MapRoute("Lang2RouteToController1Action1", "Lang2Controller/Lang2Action/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional } );
Of course, you will need to create many routes, but you can create a configuration file or save routing data in a database and simply create them in a loop when the application starts. In any case, I think this is better than creating plant methods, because if you want to add another language, you will need to find actions on all your controllers and recompile the code. But in the case of routes and the configuration file, this is not so difficult. Secondly, the extension Html.ActionLink ("Home", "Index", "Home") - you will need to implement your own in order to return a link with a localized action.
er-v
source share