How to internationalize actions

From Sense/Net Wiki
Jump to: navigation, search
  •  
  •  
  •  
  •  
  • 100%
  • 6.1.1
  • Enterprise
  • Community
  • Planned

Overview

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.

Details

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

Steps

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:

  • /Root/(apps)/GenericContent

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.

Related links

References

This page does not have external references.