ASP.NET MVC 2 i18n

2020-07-29 00:26发布

问题:

I found the following page on i18n and ASP.NET: http://wiki.asp.net/page.aspx/55/internationalization/

The videos were very helpful although they apply to ASP.NET WebForms more than ASP.NET MVC, e.g., the videos show you how to internationalize controls rather than text -- which leads me to another realization: there isn't (or I couldn't find) a resources folder in my MVC applications -- just folders like AppData.

Is there a simple way (like in the videos) to internationalize plain text in ASP.NET MVC? If not, do I have to use some sort of ASP control?

回答1:

There's a guide here:

http://adamyan.blogspot.com/2010/02/aspnet-mvc-2-localization-complete.html

Scott Guthrie linked to it recently via twitter, so I'll take it must be good.

Edit: remember to check the following post in the blog, as it tells you how to use routes instead of session values to configure the language for the user. http://adamyan.blogspot.com/2010/07/addition-to-aspnet-mvc-localization.html