IContentRepository에서 사용할 수있는 CreateLanguageBranch
을 사용해야합니다. 스웨덴어 아래에있는 내 예에서
사이트의 기본 언어입니다
var parent = ContentReference.RootPage;
IContentRepository contentRepository =
EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<IContentRepository>();
StartpagePage startpage = contentRepository.GetDefault<StartpagePage>(parent);
startpage.PageName = "Teststartsida";
startpage.Title = "Teststartsida";
// this will create a startpage in the default language, Swedish in my case,
// use SaveAction.Publish and save the page into a new variable
var createdPage = contentRepository.Save(startpage,
EPiServer.DataAccess.SaveAction.Publish,
AccessLevel.NoAccess);
// invoke CreateLanguageBranch with LanguageSelector
var startpageLanguageBranch =
contentRepository.CreateLanguageBranch<StartpagePage>(createdPage,
new LanguageSelector("en"));
startpageLanguageBranch.PageName = "Start page test";
startpageLanguageBranch.Title = "Start page test";
// this will create a languagebranch in the language stated with the LanguageSelector.
// Use SaveAction.Save
contentRepository.Save(startpageLanguageBranch,
EPiServer.DataAccess.SaveAction.Save,
AccessLevel.NoAccess);