Show TOC

 Changing Labels for CommandsLocate this document in the navigation structure

Use

The use of bundle files allows you to modify labels as well as localize the language.

The example below shows how you use suitable labels for different languages and how you swap the English label Details (for the command that calls up the Details dialog box) with the label Properties.

 

Prerequisites

You have worked through the steps that are described in Creating an Example Project in SAP NetWeaver Developer Studio .

 

Procedure

 

  1. In the SAP NetWeaver Developer Studio, create a bundle file for each language. Use a text editor to do this. Note the following conventions:

    <bundle file name>_<language>.properties

    For example: 

    my_UICConsts_de.properties

    my_UICConsts_es.properties

    You also need a bundle file for the default language (usually English).

    For example, my_UICConsts.properties

 

  1. In each of these files, create an entry in the format key =label.

    For example:

    For the German bundle file my_UICConsts_de.properties:

    test_properties=Eigenschaften

    For the Spanish bundle file my_UICConsts_de.properties:

    test_properties=Propiedades

    For the default bundle file my_UICConsts.properties:

    test_properties=Properties

 

Note

Do not use spaces in keys. Use underscores instead.

 

  1. Build and deploy the development components that contain the bundle files (see Building and Deploying Development Components ).

 

  1. In the portal, choose System Administration → System Configuration → Knowledge Management → Content Management → User Interface → Commands → UI Command and create a new command:

    For example:

    Alias         = companyname_PropertiesBundle File   = com.<%companyname%>.km.resource.bundle.my_UICConstsKey for Label = test_propertiesJava Class    = com.sapportals.wcm.rendering.uicommand.cm.UIDetailsCommand

 

Note

We recommend that you use a prefix for the aliases of your commands. This makes it easier for you to distinguish between commands contained by default and commands that you have created yourself.

 

Result

The label for the command is now displayed in the portal language on the interface. If no bundle file exists for the language set, the label is displayed in the language of the default bundle file (English).