Localization

Overview

With the decoupled Sitefinity ASP.NET Core Renderer, you can localize your application by utilizing several techniques. These techniques are applicable in different scenarios. 

All the techniques described in this article are dependent on the currently requested version of the page that is being rendered. The Renderer automatically determines the language of the page and passes it to the ASP.NET Core APIs. This is done in the following way:

  1. Sets the Thread.CurrentUICulture property.
  2. Sets the Culture property of the IRequestContext class (can be injected through DI)
  3. Provides a custom IRequestCultureProvider.
    For more information, see Globalization and localization in ASP.NET Core » Use a custom provider.

Localize using the native localization implementation

Use this approach when you want to localize labels that will be managed by developers. They are stored in the source control and are be deployed through CI/CD.

This approach utilizes the built-in ASP.NET Core APIs. When you use this approach, you are able to localize any resource in your application – both in the views and the VewComponents
For more information, see Globalization and localization in ASP.NET Core.

GITHUB EXAMPLE: The Localization sample, located in Sitefinity GitHub Repository illustrates how to use the out-of-the-box ASP.NET Core localization with Sitefinity ASP.NET Core widgets.

Localize through the content modules

Use this approach to localize content. This is the most common localization, used by content editors. It allows content editors to translate content without involving a developer.

This type of localization minimizes the customizations of the project and keeps it clean and simple.You do this when you create content and then translate it manually or through the Translation service. 
For more information, see Languages and Translations.

After the translation, the localized version of the content is displayed on the frontend, depending on the currently selected language of the page. This is handled automatically by built-in widgets, such as Content list or Image widget, and also by custom widgets that use the automatically generated widget designers.
For more information, see Autogenerated field types.

The translated version of the content is fetched automatically even in custom implementations, when you call the services directly, using the IRestClient interface and its methods Get<TItem> and GetItems<TItem>.

Localize through widgets

Use this approach when you want allow localization of particular widgets and their properties.
You do this by exposing the localized resources as properties in the widget designers.

This allows non-developers to translate the properties manually through the widget designers. For more information, see Autogenerated field types.

After the translation, the widget resolves the version of the properties for the current language of the page. Except for the Section widget, all the other widgets support property localization and each property can be localized independently. Additionally, when working on a synced page, you can override all translated versions with the current one, by saving the widget with the option Save all translations.

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?