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:

  1. Get an instance of the PageManager class.
  2. Check whether a parent page node is set.
    If you do not specify the parent node, the page is set under the root node.
  3. 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. 
  4. Get the page data by passing the culture to the GetPageData method of the page node.
  5. 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.
  6. Set the ApprovalWorkflowState to Published by passing the culture for the desired localized version.
  7. Save the changes.

Was this article helpful?