Kentico CMS 6.0 Developer's Guide

Localization expressions

Localization expressions

Previous topic Next topic Mail us feedback on this topic!  

Localization expressions

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

If you need to supply a localized value into a field or text area where localization expressions are supported, you can use expressions in the following formats:

 

Format

Description

Sample Value

Basic format:

 

{$key$}

Displays value of the resource string with the specified key. Strings can be viewed and edited in Site Manager -> Development -> UI Cultures or in the .resx files under the CMSResources folder.

 

{$myform.firstname$}

In-place localization:

 

{$=default_string|culture_code=translation|culture_code=translation|etc.$}

Displays the strings defined in the expression.

 

On the left, you can see an example that displays Hallo for German culture, Ciao for Italian and Hello for all other cultures (default value).

 

{$=Hello|de-de=Hallo|it-it=Ciao$}

 

See also: Development -> Macro expressions

 

Localization dialogs

 

Fields in the Kentico CMS interface that contain the display names or descriptions of objects provide a more user friendly way to handle localization. This is achieved using action buttons and dialogs that allow you to insert resource strings and edit their text and translations directly from the given section of the UI.

 

Please note that these actions are only available for websites that are multilingual, i.e. those that have more than one culture assigned in Site Manager -> Sites -> edit (Edit) site -> Cultures. Because this feature provides a way to edit any resource string, it is only allowed for users designated as global administrators.

 

To add a resource string to a field where this functionality is supported, click the Localize (AddNewUICulture) button.

 

devguide_clip1696

 

This opens a dialog where a new string can be created, or an existing one can be selected for the field.

 

devguide_clip1697

 

Next, the text of the resource string may be edited for specific cultures. All cultures specified on the Site Manager -> Development -> UI cultures -> All cultures tab are available. If the Show only site cultures box is checked, only cultures that are assigned to the currently active site will be visible. The Show default culture option can be used to ensure that the default UI culture configured for your installation of Kentico CMS is always displayed.

 

Please keep in mind that modifying the resource string assigned to a particular field will also affect all other occurrences of the same string.

 

devguide_clip1698

 

When finished, click OK to confirm any changes to the resource string.

 

devguide_clip1699

 

It is necessary to save the form using the OK button to confirm that the string should be inserted into the field (some forms may use a Save Save button at the top of the page instead). The field will now be localized and its value will be displayed according to the current culture settings.

 

The text of the resource string can be edited at any time by using the Localize other languages (LocalizeLanguages) button. If you wish to remove the localization string from a field, click the Remove localization (Delete) action.

 

 

 

Please note

 

Resource strings created using localization dialogs are always stored in the database. The dialogs cannot be used to interact with strings contained in resource files (.resx) under the CMSResources folder.