Creating site specific resource strings

All default resource strings are stored in the cms.resx file located in the Kentico project's CMSResources folder. However, you can also create sets of resource strings for specific websites. See Working with resource strings to learn which resource string files have higher priority than others.

Site-specific resource strings allow you to deploy strings together with individual sites, without needing to expand the system's main cms.resx file.

Note: Site-specific resource strings cannot be edited from the Kentico administration interface, only through the created resx files.

To create site-specific resource string files:

  1. Open your Kentico solution in Visual Studio.
  2. Expand the web project's App_Data folder and create a subfolder named <siteName>\Resources.
  3. Right-click the Resources folder and select Add -> Add New Item.
  4. Create a file with any name and the .resx extension (for example default.resx).

    This creates a site-specific resource file for the application's default culture.

    To add resource files for other cultures:

    1. Add subfolders under the Resources folder named according to the code name of the desired culture (for example cs-CZ).
    2. Create another .resx file in each culture subfolder.
  5. (Optional) If you plan to publish your website from Visual Studio, set the Build Action property of your resource files to Content to ensure that they are included.

You can now add pairs of resource string Names and Values into the resource file to create strings specifically for the given site. For example:

Important: The Name of site-specific resource strings must always have a prefix matching the code name of the given site. You cannot create strings with the same name in the resx files of different sites.

  • Name: mysite.customString
  • Value: Text

To apply changes made in resx files to your site, you need to restart the application (for example click Restart application on the General tab of the System application in the Kentico administration interface).


Was this page helpful?