More in this section

Forums / General Discussions / Retrieve Default Language Version of a Page

Retrieve Default Language Version of a Page

4 posts, 0 answered
  1. John
    John avatar
    61 posts
    Registered:
    08 Jun 2012
    02 May 2011
    Link to this post
    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
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    03 May 2011
    Link to this post
    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
  3. John
    John avatar
    61 posts
    Registered:
    08 Jun 2012
    03 May 2011
    Link to this post
    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
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    06 May 2011
    Link to this post
    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
4 posts, 0 answered