Try our conversational search powered by Generative AI!

Create a page programatically for specific language

Vote:
 

Hello!

 

I am creating a page programatically. However the page is only created for the default language wich is english. I want to create the page for all langueages or for the langueage swedish. How do I do this?

 

my code:

 

PageReference parent = new PageReference(53);
            PageData myPage = EPiServer.DataFactory.Instance.GetDefaultPageData(parent, "Profile");

            myPage.PageName = username;
            myPage.URLSegment = EPiServer.Web.UrlSegment.CreateUrlSegment(myPage);
            //myPage.languegaeID = "sv";  something like this??

            DataFactory.Instance.Save(myPage, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess);

#52211
Jul 12, 2011 14:58
Vote:
 

After you created a page in English you can create other languages for the page using

DataFactory.Instance.CreateLanguageBranch(myPage.PageLink, SomeLanguageSelector)

    

#52224
Jul 12, 2011 21:31
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.