How to internationalize actions
Sense/Net ECMS comes with built-in Localization features to enable users to translate their sites and/or change language settings of pages by a single click. A special case of localization is when you need to localize actions displayed on portal pages. This article shows you how to create localized actions and action menus.
The displayed text of an action that is visible on a portal page is originated from the Display Name field of the Application behind it. If you want to create an action that can be localized you need to define a special display name for the application.
Field localization syntax
If a field (in our case the Display Name) is localizable, it may contain a string resource key using the following syntax.
- $ Resources: ClassName, ResourceKeyName
- or a shorter version: $ ClassName, ResourceKeyName
1. Create a string resource
Add the necessary string resource key and value for the display name to the resource xml file. We will create a new action in this tutorial called CustomCopy.
<ResourceClass name="Action"> <Languages> <Language cultureName="en"> <data name="CustomCopy" xml:space="preserve"> <value>Custom copy</value> </data> </Language> <Language cultureName="hu"> <data name="CustomCopy" xml:space="preserve"> <value>Speciális másolás</value> </data> </Language> </Languages> </ResourceClass>
For more information about localization see the following article:
2. Localize the application
Create the application (e.g. a Portlet Page) with the name CustomContent (if it does not exist yet) in the following folder:
Set the properties of the application. The display name will refer to the string resource we created before.
- Display name: $ Action, CustomCopy
- Scenario: ListItem (this is set only to make the result visible more easily)
The action will be displayed as Custom copy in the list item menu of every list item as you can see in Content Explorer. Check the localized display name of the action by changing the language to the other language you created the resource for.
This page does not have external references.