I want user to select preferred language once for the whole app. suggest me the easiest possible steps.
Such that user select preferred language only once just after login and then all app's view rendered with selected culture.
I found somehting related here
Because i am new in Internationalization i am not getting it properly.
I created a sample application which is working fine with browser specific Culture but here i want user to select preferred language.
One way to do it is with a cookie.
Assuming you have a drop-down list or some kind of input where the user can choose the language, have that input post to an action method. In that action method, write the language id to a cookie:
You can then use an HttpModule to set the culture for every request. This way you know the culture is set throughout the entire request processing pipeline, instead of just when your controller actions execute:
To register the module with IIS & IIS Express, see this web.config (note the Cassini config would be a little different)
I propose you to extend User entity with Culture parameter to store it in DB. Then it possible to add information about user culture in Session for example (but any other technique also could be used)
then you need to add new Attribute with code
And add this attribute to all your controllers which should be localized
Typically, .NET will use the CultureSetting that best matches the user and then determines the appropriate resource file to use for globalization.
Once you have "saved" the users appropriate culture be in a database, session, or cookie.
What I do is change the thread to the appropriate language:
Hope that helps!