views:

528

answers:

2

I'd like to use resource file (.resx) to do localization in ASP.NET MVC. My thought is:

  1. Make a default resource file under App_GlobalResources folder Make several local resource files under App_LocalResources folder
  2. read cookie info to set CultureInFo Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

then, I'd like to use resource file in controller to set ViewData value, something like:

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

but the syntax is wrong, how can I do this?

Any idea?

+1  A: 

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

Gidon
Thank you! I tried that.But this solution is not working on ASP.NET MVC Release 1
emalamisura
Actually I have it working under RC. He does have an older version on his website that doesn't work under RC, maybe you once tried that one.
Gidon
A: 

Did you tried following?

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

If you have Resource.aspx file in your App_GlobalResources this should work.

Jakub Šturc