Retrieve Default Language Version of a Page

Posted by Community Admin on 03-Aug-2018 22:00

Retrieve Default Language Version of a Page

All Replies

Posted by Community Admin on 02-May-2011 00:00

Hello,

Our site will be localized, with several different languages. We currently have code to retrieve specific pages nodes by their url name.

Our current code looks like this:

this.PageManager.GetPageNodes().Where(n => n.UrlName == urlName).SingleOrDefault();

which is using the code from the Developer's Guide for querying pages by URL. This is working fine, and returning a page as long as it has been defined for the current culture.

We would like to be able to get a reference to the default language (English, in our case) version of the page node in the case where the page for the current culture has not been created yet. Is this possible? If so, how do we determine the default language, and how can we use that information to get that specific version of the page?

Thanks for any insight!

Regards,
John G

Posted by Community Admin on 03-May-2011 00:00

Hello John,

You can get the default backend language by using DefaultBackendLanguage property of Telerik.Sitefinity.Abstractions.AppSettings.

To get a page on a specific culture you should set the CurrentUICulture to the language you want to query.

Best wishes,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 03-May-2011 00:00

Thank you Ivan.

If we set the current culture in a control on the page, will that affect everything else on the page, or just calls after that point in the context of the control?

We basically want to "override" the current language (culture) setting to grab a different language version of the page (actually, a page node) without affecting anything else on the page. Will this technique work for that?

Thanks again!

John G

Posted by Community Admin on 06-May-2011 00:00

Hello John,

You can set the CurrentUICulture, but after you execute your logic you should return it back the the initial value, otherwise the other data on the page might be affected.

All the best,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed