Learning asp.net mvc and whenever I worked we had to localize our application. Looked at few articles eg
- http://afana.me/post/aspnet-mvc-internationalization.aspx (Creates a view for each language) No for me
-
http://www.codeproject.com/KB/aspnet/BilingualMvc3Part1.aspx (uses Broswer default language which will never work for me. Can you imagine I am English speaker on holiday in Spain and need to use the website and i have not got a clue about how to change the settings) NO
-
http://geekswithblogs.net/shaunxu/archive/2010/05/06/localization-in-asp.net-mvc-ndash-3-days-investigation-1-day.aspx ( this one via URL but looking at his baseController sort of hardcode the application name in the cookie)
I am CONFUSED. Mainly because my knowledge is not great!!
What is the recommended way to do it? Have you done in real world app? Would you share code? A snippet of how you tackled the problem will do?
I am looking for a neat way like you can do in asp.net .I need to give the ability to user to change languages at run time by clicking a flag or something.
Is there a base method to override?
Is there a proper example somewhere? Do you have to write some sort of baseController class?
thanks a lot for your time
You should use resource files to handle localisation. With that you have the ability to get a language the user has choosen before or he has choosen right now. Here is a good blog how to do that http://adamyan.blogspot.com/2010/02/aspnet-mvc-2-localization-complete.html
IF the user has no active session, means no cookie that identifies him you should use the browser language or a maybe a geotracking service to determine the sitelanguage. It is up to you to present a easy way to change the current language… And as mentioned above resourcefiles will help you here.