Let's say I have a web site that is translated in to two languages - English and Spanish. I want to give the users a toggle switch at the top of the page that allows them to switch back and forth between the two languages. How would I do that? I don't want to set up different websites. I only want one website. I just want the user to be able to click on a button or link or something and go from English to Spanish. Now as they move around the site they are viewing the entire site in Spanish. Then if they click on the button or link again they would go back to English. Is there something I have to do in the code behind to tell Sitecore to "use" a different language?
1
votes
3 Answers
4
votes
2
votes
Typically in Sitecore you will want to represent the language using the built-in URL prefixes, e.g. http://www.example.com/en or http://www.example.com/es. We often use a cookie that we read in the httpRequestBegin pipeline to enhance the Sitecore LanguageResolver. Your language "toggle" could appropriately set that cookie.
See this article by John West for more detail and sample code.