In Sitefinity, resource classes are the main localization structure. Resource classes are used to distribute labels among multiple projects or to enable translations of labels and text inside widgets or modules. With its modules, Sitefinity provides predefined resource classes. When you create custom widgets or specific functionality, you need to create your own resource class. The following article demonstrates how to create a new resource class and register it in Sitefinity.
To create a custom resource class, you add a class to your Sitefinity project. By convention, you must name the file with Resources suffix, for example, ProductsResources. It must inherit the Resource class, which can be found inside the Telerik.Sitefinity.Localization namespace. Use the following example:
(ProductsResources), Title =
, Description =
ProductsResources : Resource
A resource represents a property inside the class. For example:
/// phrase: Amazon Search
/// <value>Amazon Search</value>
"phrase: Amazon Search"
Every resource is using the ResourceEntry attribute. The attribute binds the property name with a specific value, last modified date, and description.
NOTE: You can either add the resources to the class programmatically, using the above example, or you can add them using the UI after you register the resource class, as described below. After registration, the class becomes available under Administration » Labels & Messages.
You can add as many resources to the class as you need.
To use the newly created custom resource class, you must register it on application initialization. You do this is inside the Application_Start method of the Global.asax class. You must subscribe to the SystemManager.ApplicationStart method and add the following code inside:
sender, EventArgs e)
SystemManager.ApplicationStart += SystemManager_ApplicationStart;
When you restart the application, the class is registered and becomes available under Administration » Labels & Messages. Whenever you add new resources, you can point to the newly created resource class.
NOTE: When a new resource is added or translated through the backend, a physical file is created in ~/App_Data/Sitefinity/GlobalResources folder. Make sure to deploy those files when you move your site from development to production.
You can reference the labels from the custom resource class both from WebForms and MVC widgets and controls. In addition, you can reference the labels through code behind.
Reference from the template using the following snippet:
<%$ Resources:ProductsResources, AmazonSearchServiceTitle %>
Reference from the view using the following snippet:
//use this using statement in your view
Reference through code behind via the following using statement:
Next, reference the label using the following code snippet:
Back To Top
Custom Products module: Create the localizable resources
You can download the Progress Sitefinity CMS SDK samples from GitHub:
.NET localizable resource handling