London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Quick switch of language?

Vote:
 

I would like to have a link in my menu (.ascx) to different languages so that the link points to the same page (ID). Can't just find a simple way to do <a href=" ???????? " > to achieve this. Good hacks?

#77393
Nov 18, 2013 13:47
Vote:
 

Here's some sample code: Programmatically switching language branch in EPiServer.

Frederik

#77397
Nov 18, 2013 14:13
Vote:
 

Didn't quite get how i can use that info to construct a link...further:

this does not work, why?

CurrentPage.GetPageLanguage("en").LinkURL used on a (eg) finnish page does not produce link to the english page.

/Lassi

#77616
Nov 21, 2013 16:56
Vote:
 

Hey,

Try this:

var pageReference = new PageReference(???)
foreach(culture in siteCultures){
  var urlResolver = ServiceLocator.Current.GetInstance<UrlResolver>();
  var url = urlResolver.GetVirtualPath(pageReference, culture);
}

    

#77623
Nov 21, 2013 17:47
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.