Create a localized page
To create a localized page, you set the required culture by passing it as a parameter to the Lstring properties of the page.
In the code example below, you perform the following:
- Get an instance of the PageManager class.
- Check whether a parent page node is set.
If you do not specify the parent node, the page is set under the root node.
- Check whether a page with the same ID already exists.
If a page with such ID does not exist, create the page by calling the CreatePage method of the PageManager class.
- Get the page data by passing the culture to the GetPageData method of the page node.
- Set the properties of the page data and page node objects.
Passing the culture when setting the Title of the page node ensures that the page is localized for that specific culture.
- Set the ApprovalWorkflowState to Published by passing the culture for the desired localized version.
- Save the changes.