Add a translation to a localized page

To add a translation for other languages to a page, you choose one of the two types of localization strategies:

  • Synced
    All languages share a single page object and localization is done at LString property level. Thus, every new translation of your page has the same page widgets and layout. If you change the page widgets and layout of any of the translated pages, these changes are propagated to the other language versions as well.
  • Split
    Have a completely different page object for each language. Thus, when you add a translation to your page, you can choose whether to copy the page widgets and layout from other translated page or create your page layout from scratch.

Add a translation using Synced localization strategy

  1. Get an instance of the PageManager class.
  2. Find the page node using the page node ID.
    If a page node with the same ID does not exist, discontinue the execution of the method.
  3. Set localized values for the desired PageNode properties.
  4. Set the localization strategy to Synced by calling the InitializePageLocalizationStrategy method of the page manager.
    NOTE: You set the localization strategy only once when adding a translation for the first time.
  5. Get the page data by calling the GetPageData method of the page node. 
  6. Set localized values for the desired PageData properties.
  7. Set the ApprovalWorkflowState to Published by passing the culture for the desired localized version.
  8. Save the changes.
 

Add a translation using Split localization strategy

  1. Get an instance of the PageManager class.
  2. Find the page node using the page node ID.
    If a page node with the same ID does not exist, discontinue the execution of the method.
  3. Set localized values for the desired PageNode properties.
  4. Set the localization strategy to Split by calling the InitializePageLocalizationStrategy method of the page manager.
    NOTE: You set the localization strategy only once when adding a translation for the first time. For subsequent translations, you must create an empty page data object and set values for the following properties:
    • Culture
    • NavigationNode
  5. (Optional) To copy the page content from another translation, call the InitializeSplitPage method of the page manager and pass the following parameters:
    • Page node - the node from which you copy page content
    • Source culture - the culture from which you copy content
    • Target culture - the culture to which you copy content
  6. Get the page data by calling the GetPageData method of the page manager and pass the target culture.
  7. Set localized values for the  PageData properties.
  8. Set the ApprovalWorkflowState to Published by passing the culture for the desired localized version.
  9. Save the changes.

Was this article helpful?