Sitefinity CMS 13.1 has introduced changes to its Native API for working with multilingual content. The previous multilingual APIs are deprecated and no longer work, starting with Sitefinity CMS 13.1.
In this article, you learn how to migrate your existing code to the new APIs.
You can use the following APIs starting with Sitefinity 13.1:
CultureRegion
SystemManager.CurrentContext.Culture
The following code shows how to use the new CultureRegion code to set a specific culture/language for a part of your code.
Create News Item
IMPORTANT: The following are breaking changes starting with Sitefinity 13.1:
CultureInfo.CurrentCulture
CultureInfo.CurrentUICulture
Thread.CurrentUICulture
Thread.CurrentCulture
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
The following APIs are deprecated, starting with Sitefinity 13.1. If you used them in your solution based on Sitefinity CMS version older than 13.1, substitute their usage with the new APIs described below:
To get all languages and default language for the current site, use one of the following:
SystemManager.CurrentContext.AppSettings
DefinedFrontendLanguages
DefaultFrontendLanguage
Multilingual
SystemManager.CurrentContext.CurrentSite
PublicContentCultures
DefaultCulture
To retrieve information for languages in Administration » Settings » Languages, use AppSettings.CurrentSettings with the following properties:
AppSettings.CurrentSettings
The following APIs are available starting with Sitefinity CMS 13.1 and above and are the new alternatives to the above-described deprecated API. When upgrading to Sitefinity CMS version 13.1 and above, you need to rewrite your code to use the new API.
The SystemManager class is the single API entry point for getting information for the cultures and languages in Sitefinity CMS.
SystemManager
To get all languages and default language for the current site, use SystemManager.CurrentContext.CurrentSite with the following methods:
Cultures
To retrieve information for languages in Administration » Settings » Languages, use SystemManager.CurrentContext with the following methods:
SystemManager.CurrentContext
SystemCultures
DefaultSystemCulture
To see if the current site has more than one language, use the following code: SystemManager.CurrentContext.CurrentSite.Cultures.Count() > 1
SystemManager.CurrentContext.CurrentSite.Cultures.Count() > 1
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
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.
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.
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.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important