+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Sitemap page group display in other language

Sitemap page group display in other language

6 posts, 0 answered
  1. Nauman
    Nauman avatar
    35 posts
    Registered:
    28 Jul 2008
    15 Mar 2010
    Link to this post
    Hi

    I am creating a website in English and Arbic Language, i have senerio where i need to create page group with pages which will exist only in one language and should not display to other language site, means language specific page group


    Now i create a page group in English with pages it also displays in Arabic Site (it only display the page group not the inner pages) , which should not be unless if we create the localized version of that page group


    Please suggest

    Thanks
    Nauman Ahmed
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    15 Mar 2010
    Link to this post
    Hi Nauman,

    There was similar bug in Sitefinity 3.7 SP2 that has been sorted in Sitefinity 3.7 SP3. You can download a blank project and see whether the problem will appear, because we are not able to reproduce this issue locally using 3.7 SP3

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Nauman
    Nauman avatar
    35 posts
    Registered:
    28 Jul 2008
    15 Mar 2010
    Link to this post
    Thanks Ivan Dimitrov

    I will update my project from SP2 to  SP3 and if problem persist i will be back to you.

    Thanks for you help.

    Kind Regards
    Nauman Ahmed
  4. Nauman
    Nauman avatar
    35 posts
    Registered:
    28 Jul 2008
    22 Mar 2010
    Link to this post
    Hi Ivan Dimitrov

    In couple of scenerioes sitemap fails and does not full fill it's job
    I have website in English and Arabic Languages, we will go through test cases

    First Case
    PageGrop (Visible in both languages)
     --Page1(Only in Arabic)
     --Page2(Both in English and Arabic)
    Both page 1 and page 2 are visible false

    Create a pagegroup  which is visible in both languages

    Create a page page1 underneath it which only exists in Arabic not in English

    Create a second page2 in the same group which exists in both languages

      Ideally Menu sitemap should perform like this
    when you click on the page group in Arabic it should go to page1 and in English it should go to Page 2 , but not doing ideal scenario, In both cases it is going to Page1

    Second Case
    Page Group (both in English and Arabic)
    --Page1(Only in Arabic Visible false)
    --Page2(Both in English and Arabic Visible True)
    Click on the page group it goes to the hidden invisible page, which is totally wrong :(

    Have look please.

    Thanks
    Nauman Ahmed
  5. Nauman
    Nauman avatar
    35 posts
    Registered:
    28 Jul 2008
    25 Mar 2010
    Link to this post
    Hi Team

    Can i aspect something from you guys that, is this a  bug? or can be tweak with code.

    Many Thanks
    Nauman Ahmed
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    29 Mar 2010
    Link to this post
    Hello Nauman,

    As you can see from the PageGroup definition it goes to its first page. This means that it will redirect to its first subpage instead of opening its own content.

    There are three options

    1.When the page does not exist in the current language version - show a user friendly label that says the page does not exists in this language

    2. Bind the language bar control depending on the page language - you need to create a custom control to switch between the versions

    sample code

    //GET THE CURRENT PAGE id
    Guid pageID = new Guid(this.Context.Items["cmspageid"].ToString());
    var Manager = new CmsManager();
    ICmsPage cmsPage= (ICmsPage)Manager.GetPage(pageID, true);
    if (!Page.IsPostBack)
    {
        foreach (IPageContent version in cmsP.LanguageVersions.Values)
        {
            int cultur = version.LangID;
            CultureInfo culture = new CultureInfo(cultur);
            string languageName = culture.Name;
            ListItem item = new ListItem();
            item.Value = languageName;
            item.Text = languageName;
            if (String.IsNullOrEmpty(item.Text))
            {
                // return def culture you can use LocalizationManager
                item.Text = "en";
            }
            // ADD THE ITEMS TO A LIST
      
        }
    }

    3. Modify your SiteMap control to detect the page language and page redirect

    sample code

    protected void Page_Load(object sender, EventArgs e)
       {
           RadMenu1.DataBind();
           IList<string> allLangs = new List<string>();
           CultureInfo info = System.Threading.Thread.CurrentThread.CurrentUICulture;
           CmsSiteMapNode node = SiteMap.CurrentNode as CmsSiteMapNode;
         
           if (node.ParentNode.HasChildNodes && node.Parent.PageType == CmsPageType.Group)
           {
               var manager = new CmsManager();
               var p = (ICmsPage)manager.GetPage(node.PageID);
     
               IDictionary<int, IPageContent> lngVersions = p.LanguageVersions;
               foreach (var key in lngVersions.Keys)
               {
                   string pageLang = GetLanguage(key);
                   allLangs.Add(pageLang);
               }
               foreach (SiteMapNode siteMapNode in node.ParentNode.ChildNodes)
               {
                   CmsSiteMapNode cmsNode = siteMapNode as CmsSiteMapNode;
                   int langID = cmsNode.CmsPage.LangID;
                   foreach(string k in allLangs)
                   {
                       bool ex = (langID.ToString() == k);
                       if (ex)
                       {
                           // make response redirect to the proper version
                       }
                   }
                    
               }
       
           }
     
       }
     
       private string GetLanguage(int culture)
       {
           string lang = culture.ToString();
           if (culture == 127)
           {
               lang = "127";
               return lang;
           }
           else
           {
               lang = "2";
               return lang;
           }
       }



    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
6 posts, 0 answered