I currently have all static text in my website using the resource files to serve up english or spanish text depending on the users browser settings. This is easy. What I would like to do now is serve up content in my views that is coming from the database depending on the UI Culture. I have structured my database so that I have both english and spanish descriptions for products etc.. But I don't know how to serve one or the other based on UI Culture.
I would also like the ability to have a toggle button somewhere on the site so that a user can switch the language setting to spanish if english is showing or other way around.
I have this piece of code that can change the UI Culture on a single page/view.
System.Threading.Thread.CurrentThread.CurrentUICulture =
new System.Globalization.CultureInfo("es");
I'm sure that storing that in a cookie or session is a step in the right direction of making a toggle button. But what about serving the content from the database based on UI Culture. I was thinking I could base each view by determining what the UI Culture is set to and then serving either the SPanish or the English content. But is there a tutorial or something I could find to help me do this with MVC 4.
Any help would be greatly appreciated. I have heard of using Action Filters, but when I read up on it, there was no clear way of doing it that I could find. My site only needs to support for 2 languages.