changing language programmatically

Member since: 2008
 

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!

#22624 Aug 09, 2008 16:03
  • Member since: 2006
     

    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.

    Cheers!

    /Ted

    #22628 Aug 09, 2008 22:11
  • Member since: 2008
     

    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.

     G'day/Lei

    #26679 Dec 15, 2008 18:12
  • Member since: 2005
     

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

    M.

    #26680 Dec 15, 2008 20:40
  • Member since: 2006
     

    Hi.

    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

    #26681 Dec 15, 2008 22:05
  • Member since: 2008
     

    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!

    #26696 Dec 16, 2008 14:25