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

Forums / Developing with Sitefinity / Creating Other Language pages

Creating Other Language pages

2 posts, 0 answered
  1. HRC
    HRC avatar
    44 posts
    Registered:
    16 Mar 2009
    27 Apr 2009
    Link to this post
    I am building a multi lingual site and I have created the entire English site. I would like to somehow generate the Other Language pages now including the Template and generic content controls.  Anyone know there is a way of doing this?

    Thank You
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    27 Apr 2009
    Link to this post
    Hello ChrisH,

    There are two ways - you can create a page and after you have enabled localization you can copy from other languages. Check out attached screenshot.

    Another option is to do this programmmaticlly.

            CmsManager cmsManager = new CmsManager(); 
            foreach (ICmsPage page in cmsManager.GetPages(Guid.Empty)) 
            { 
                if (!page.Name.Equals("MyPage1")) 
                    continue
                CultureInfo currentCulture = CultureInfo.GetCultureInfo(page.LangID); 
                foreach (CultureInfo culture in LocalizationManager.Cultures.Values) 
                { 
                    if (culture.Equals(currentCulture)) 
                        continue
     
                    Thread.CurrentThread.CurrentUICulture = culture; 
     
                    ICmsPage newPage = (ICmsPage)cmsManager.GetPage(page.ID, true); 
                    if (newPage.HasCurrentLanguageVersion) 
                        continue
     
                    newPage.MenuName = String.Concat(page.MenuName, "_", culture.Name); 
                    cmsManager.SavePage(newPage); 
     
                    IStagedPage staged = cmsManager.GetPage(newPage.ID, true).Staged; 
                    staged.CopyFromLanguage(currentCulture.LCID); 
     
                    staged = cmsManager.GetPage(newPage.ID, true).Staged; 
                    staged.CheckIn(); 
     
                    Thread.CurrentThread.CurrentUICulture = currentCulture; 
                } 


    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
2 posts, 0 answered