This will be my last blog post on this adress as my blog has moved to the new Community area on Sitecore.net: http://www.sitecore.net/en/Community
You will find my blog on this url: http://www.sitecore.net/en/Community/Technical-Blogs/Morten-Ljungberg-Sitecore-Whats-New.aspx
I will be porting all my previous posts too.
Thursday, September 30, 2010
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 ;))
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 ;))
Subscribe to:
Posts (Atom)