Custom Language Selector

Posted by Community Admin on 04-Aug-2018 12:03

Custom Language Selector

All Replies

Posted by Community Admin on 26-Aug-2011 00:00
Hi!

I am have two languages one is English and second is Arabic on web. I need to perform some task on changing language event from my custom control. I done it but unable to get the respective page url of the currently switched language or culture.

Example:

Let suppose I am at this url http://192.168.1.50:1377/other-links/quicklinksl1/mediacenter which is in English and now I clicked on language selector to get the page in Arabic language i-e URL http://192.168.1.50:1377/ar/other-links/quicklinksl1/mediacente-ABCSr. Please tell me how can I get this Arabic url of the page using code so that i can write the code in my custom language selector control.


Thanks
Posted by Community Admin on 02-Sep-2011 00:00
Hi Waqar,

You can try with the following code:

var currentNode = Telerik.Sitefinity.Web.SitefinitySiteMap.GetActualCurrentNode();
var culture = new System.Globalization.CultureInfo("name of the culture, it must be installed");
var url = currentNode.GetUrl(culture, false);


All the best,
Pavel
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

This thread is closed