Kentico CMS 7.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.

 

To add a resource string to a field where this functionality is supported:

 

1. Click the Localize (AddNewUICulture) button.

 

devguide_clip1696

 

2. A dialog opens where you can create a new string or select an existing one for the field.

 

devguide_clip1697

 

3. Edit the text of the resource string for individual cultures. You can use machine translation services to assist with the translation (if there are any configured for your application).

 

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 assigned to the currently active site are 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 also affects all other occurrences of the same string.

 

devguide_clip1698

 

4. Click OK to confirm any changes made to the resource string.

 

devguide_clip1699

 

5. Save the form by clicking Save Save at the top of the page to confirm that the string should be inserted into the field (some forms may use an OK confirmation button instead).

 

The field is now localized and it displays its value according to the current culture settings. You can edit the text of the resource string at any time by clicking the Localize other languages (LocalizeLanguages) button. If you wish to remove the localization string from a field, click the Remove localization (Delete) action.

 

 

InfoBox_Note

 

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.