Dec 27, 2010 10:30 AM|francesco abbruzzese|LINK
Localization is a .Net feature, not an asp.net or Mvc feature, so it works also with Mvc.
The way you specify what culture to use for the web site or for a single page is exactly the same in asp.net and mvc...This is the only part that is pecific to web application, the remainder is standard .Net.
The only point is that some asp.net server controls (such as a label for instance) can be configured to take their text from a resource file from visual studio designer in classical asp.net(by using the property tab), in case of mvc yo need to put manually
the string exposed as property of the resource file....but this is easy as shhown in some other posts of this thread..
The issue is quite simple to implement...no need to do complex things.
1) put :
<globalization culture="auto" uiCulture="auto"/>
this way the culture used in the request will be taken from the user browser
2) if you want you can override the values detected by the system by letting the user choose a culture from a dropdown and storing it in a cookie or Session Variable.
3) To override the culture just use Thread.Current...that contains ponters to the current Culture and UIculture. The Culture is used to decide how to format numbers, dates and so on, while the UICultue is used to choose among the various resources files associted
to the web site, and thus determines the languages of all Text and messages.
3) Just use NameofResource.StringName to retrieve a message or text you gave the name "StringName", then .Net will automatically select the resource associated to the current UICulture.
4) Use this string in your views by using <%:......%>
for more details see there:
The above is a general description for asp.net...Mvc has nothing different...the only difference is that you cannot select the resource text from the property browser...but you have to insert it in the view as at point 4).