How to create multilingual pages programmatically?
Hi Sitefinity Guys
I have to generate some pages (like 5000) out of a sql database. To create a simple page is easy.
But in my case i have 5 Languages in the system and i want to generate the language versions of each page too.
I tried some approaches but they all failed.
Can you give me a hint? or better an example code?
It depends on you want to have synced or split pages. For synced pages you should only change the CurrentUICulture and keep working the with the PageManager. This will create a page on the current language.
Here is the programmatic way
var pageNode = pageManager.CreatePage(PageLocation.Frontend, Guid.Empty, NodeType.Standard);
var page = pageNode.Page;
page.LocalizationStrategy = Localization.LocalizationStrategy.Split;
page.UiCulture = lang.Name;
page.Culture = lang.Name;
page.IsAutoCreated = true;
the Telerik team
Thanks for your reply.
I built your code in, but i get an Exception:
I try this :