Localization

Overview

With the decoupled Sitefinity .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 .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 .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.

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.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?