ASP.NET MVC Localization

I would like to use a resource file (.resx) for localization in ASP.NET MVC. My thought:

  • Make a default resource file in the App_GlobalResources folder Make multiple local resource files in the App_LocalResources folder
  • read the cookie information to set CultureInFo Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US");

then I would like to use a resource file in the controller to set the ViewData value like:

ViewData["Title"] = Resources:Resource, PageTitle;

      

but the syntax is incorrect, how can i do this?

Any idea?

+1


source to share


2 answers


Take a look here: ASP.NET MVC: Simplified Localization via ViewEngines



+3


source


Have you tried following?

ViewData["Title"] = Resources.Resource.PageTitle;

      



If you have a Resource.aspx

file in App_GlobalResources

, this should work.

+1


source







All Articles