Tuesday, June 1, 2010

Language switching

I am mostly writing this post because I keep forgetting how to get a language different from the current context language through the Sitecore API based on a string value. So to remind myself; here we go:

Language lang = Sitecore.Globalization.Language.Parse("da-DK");
Sitecore.Context.SetLanguage(lang, true);

From here on the language will be set as da-DK no matter what the current language is.

(Remember this blog is for new Sitecore developers! So all you hardcore Sitecore developers don't give me heat for writing about too basic stuff ;))

No comments:

Post a Comment