Try our conversational search powered by Generative AI!

changing language programmatically


I'm trying to make little cute flag icons that switch between the different language versions of the site.

Could anyone give any pointers as how to achieve this? Changing Culture and UICulture doesn't seem to do anything.

Thanks a lot!

Aug 09, 2008 16:03

Hi Kristian!

You can use the GetPage() method to get the URL for a page for a specific language branch and then use this URL to set up a link for your language switch flag.



Aug 09, 2008 22:11

Hi Kristian, I'm facing the same problem now, have you fixed it? would u please be so nice to put some source code here? I'm really new to Episerver and tried what Ted wrote above, didn't work, or maybe I screwed up somewhere, Would u please give a little help here? or Ted? some source could would be really helpful.


Dec 15, 2008 18:12

If you want to create a link to swap from some language to another you can use UriSupport.AddLanguageSelection(CurrentPage.LinkURL, "en");


Dec 15, 2008 20:40


I think you should use the StaticLinkURL instead. Then you will get the url to the page without the epslanguage specified in the url.

UriSupport.AddLanguageSelection(CurrentPage.StaticLinkURL , "en");

To check which languagebrances a page is created in, you can check the CurrentPage.PageLanguages.

BR, Tore Gjerdrum

Dec 15, 2008 22:05

Hi guys, thx for ur answer, excuse me if my question is stupid. I did tried that, very simple, I put UriSupport.Addlanguageselection(currentpage.linkurl,"en") on a button click even, but it doesn't seem to work. The page does exists in the selected languae and everything else seem to be fine also, what might the problem be? yeah, when I click the button, it added 'default.aspx' in the end of the url(I tested the start page). May u folks be so kind to explain a little? thx!

Dec 16, 2008 14:25
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.