Question

I have a website built in mvc3. I want to have an image of the Spanish flag and then when clicked on the site language changes to Spanish. I have not developed the site but i notice it is using CurrentUICulture. Im guessing i can trigger a function and then store the culture in a session variable and set this as the culture?

  private string CultureString
    {
        get
        {
            return Thread.CurrentThread.CurrentUICulture.Name;
        }
    }
Was it helpful?

Solution

That sounds good to me ... the only thing you might want to consider is whether people should be able to share links / bookmark the localized versions of your site. If you want that feature, you should put the culture in either the path or the query string, ie /home/index/es-us, or home/index?locale=es-us.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top