Localization with separate Language folders within Views
Posted
by Adrian
on Stack Overflow
See other posts from Stack Overflow
or by Adrian
Published on 2010-06-17T16:35:10Z
Indexed on
2010/06/17
21:13 UTC
Read the original article
Hit count: 306
I'm trying to have specific folders for each language in Views. (I know this isn't the best way of doing it but it has to be this way for now)
e.g.
/Views/EN/User/Edit.aspx
/Views/US/User/Edit.aspx
These would both use the same controller and model but have different Views for each language.
In my Global.asax.cs
I have
routes.MapRoute(
"Default", // Route name
"{language}/{controller}/{action}/{id}", // URL with parameters
new { language = "en", controller = "Logon", action = "Index", id = UrlParameter.Optional }, // Parameter defaults
new { language = @"en|us" } // validation
);
This works ok but always points to the same View.
If I put the path to the Lanagugage folder it works
return View("~/Views/EN/User/Edit.aspx");
but clearly this isn't a very nice way to do it.
Is there anyway to get MVC to look in the correct language folder?
Thanks and again I know this isn't the best way of doing Localization but I can't use resource files.
© Stack Overflow or respective owner