Is this really the version you are looking for? Kentico Xperience 9 Documentation is no longer updated. Use the switcher in the header to choose your product version.
Resource strings store the text displayed in the Kentico administration interface (and on the live site in some cases).
Resource string priority
When loading resource strings, the system uses the following priority:
If there are duplicate strings with the same key in all five sources, the system uses the one stored in the database.
To change the priorities, you can add the following key to your web.config:
<add key="CMSUseSQLResourceManagerAsPrimary" value="false" />When this key is added, the priorities are as follows:
If you want to modify text in the Kentico administration interface (including web part dialogs), use one of the following options:
Override resource strings in the Localization application.
Create a custom.resx file in the project's CMSResources folder and store your strings in this file.
In both cases, the keys used to identify the strings must be the same as in the default cms.resx file.
If you need to translate custom strings used on your website such as form labels, display names of objects or other static text into other languages, you can create a new resource string:
A new string in the default culture is now displayed in the list.
You can also create new resource strings directly when editing text fields in the administration interface. See Localizing text fields.
Open the Localization application.
Edit () the resource string.
If you do not see the desired language, use the Show translation for radio buttons to change the category of cultures.
Translate the string into the desired language in the corresponding Translation field.
Click Save.
The resource string and its translation are now created and stored in the database.
If you need to display resource strings within transformations, use the following code:
ASCX transformations – call the Localize transformation method:
<%# Localize("Text containing localization expressions: {$stringKey$}") %>Text / XML transformations – use localization string macro expressions or the GetResourceString macro method:
{$stringKey$}
- OR -
{% GetResourceString("stringKey") %}If you need to retrieve the value of a resource string in your custom code, use the CMS.Helpers.ResHelper.GetString method.
using CMS.Helpers;
...
// Loads the value of the 'stringKey' resource string (in the default culture)
string localizedResult = ResHelper.GetString("stringKey");