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.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?