Localize content items

To localize content items, you set the required culture by passing it as a parameter to the Lstring properties of the item.

The following code example demonstrates how to localize a News item.
NOTE
: The ID argument is assigned to the master version of the News item. For more information about the different version of a content item, see For developers: Content lifecycle.

In the example below, you perform the following:

  1. Get an instance of the NewsManager class.
  2. Check whether a News item with the same ID already exists. 
    If a News item with the same ID does not exist, create the item by calling the CreateNewsItem method of the NewsManager class. 
    You can create a News item with either predefined or auto-generated ID, depending on which overload of the method you use. The ID argument is assigned to the ID property of the master version of the item. 

  3. Set the properties of the News item object.
    Passing the culture when setting the Title ensures that the News item is localized for that specific culture.

  4. Recompile and validate the URLs of the News item.

  5. Set the ApprovalWorkflowState to Published by passing the culture for the required localized version.

  6. Publish the News item to a Live state using the content lifecycle of the NewsManager class.
  7. 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?