close

Filter

loading table of contents...

Studio Developer Manual / Version 2010

Table Of Contents

7.2 Localizing Labels

Many labels besides document types and property names can also be localized. Typical cases are labels or button texts, error messages or window titles. The localized texts are stored in property files. To use these property values, classes are generated by the MXML compiler following the singleton pattern. Property classes can be adapted as described in Section 5.6, “Localization”, typically overriding the existing value with values from a new customizing property class.

Predefined property classes of CoreMedia Studio

The following classes are predefined property classes defining labels and messages used throughout CoreMedia Studio.

  • Actions_properties

  • DeviceTypes_properties

  • Editor_properties

  • EditorErrors_properties

  • Publisher_properties

  • Validators_properties

See the ActionScript documentation for a list of defined properties.

Predefined property files of Blueprint Studio

The blueprint-forms Studio plugin contains several property files with localization entries in the studio/blueprint-forms/src/main/joo/com/coremedia/blueprint/studio directory. These files are used for to localize several features of Studio, for example tab titles, document type names or validator messages.

You can simply change the value of any of the properties as needed. While you can also add new properties to these files when building extensions of CoreMedia Studio, it is preferable to put new localization keys into new property files.

Adding a new resource bundle

If you want to add a new property file which contains your own localization keys, proceed as follows:

  1. Create a directory corresponding to the desired package of your resource bundle, for example <ModuleName>/src/main/joo/<PackagePath>.

  2. Create new properties files following the naming schema: <PropertyFileName>.properties and <PropertyFileName>_de.properties.

  3. Add one or more keys and values in the form <KeyName>=<PropertyValue>

  4. Optionally, add the same key to each locale-specific properties file, using an appropriate translation. By default, there is only one translation (German), but you can add your own.

  5. In a MXML file describing your custom component, import the resource bundle in the metadata section:

    <fx:Metadata>
      [ResourceBundle('my.package.BundleName')]
      ..
    </fx:Metadata>

    Example 7.8. Add Resource Bundle


  6. Address the resource bundle and key in the text attribute of the component where you want to use the label: ResourceManager.getInstance().getString('my.package.BundleName',<KEY_NAME>). You will get code completion in a properly configured IDE for the keys of your resource bundle.

  7. Instead of using the ResourceManager.getInstance() singleton, you can reference the resourceManager object that is available for every component instance.

Example: Adding a Search Button

In order to introduce a new localized button to the favorites toolbar you could add the following component to the file BlueprintFormsStudioPlugin.mxml for the component FavoritesToolbar.

<editor:FavoritesToolbar>
  <editor:plugins>
    <ui:AddItemsPlugin>
      <ui:items>
        <Button itemId="exampleButton">
          <baseAction>
            <editor:ShowCollectionViewAction published="false"
                                             editedByMe="true"
                                             contentType="CMArticle"
                                             text="{ResourceManager.getInstance().getString(
                                                      'com....BlueprintStudio_properties',
                                                      'doc_example_txt')}"/>
          </baseAction>
        </Button>
      </ui:items>
      <ui:after>
        <Button itemId="{FavoritesToolbar.NEW_MENU_BUTTON_ITEM_ID}"/>
      </ui:after>
    </ui:AddItemsPlugin>
  </editor:plugins>
</editor:FavoritesToolbar>

Example 7.9. Adding a search button


The attribute text of the editor:ShowCollectionView Element defines the text to be displayed in the Studio web application.

In order to have the label you want, you need to add it to the properties file. The BlueprintStudio.properties file starts like this after adding a string for the label:

doc_example_txt=My Example Button

SpacerTitle_navigation=Navigation
SpacerTitle_versions=Versions
SpacerTitle_layout=Layout
...

Example 7.10. Example property file


Override Standard Studio Labels

It is also possible to override the standard Studio labels, like so:

  1. Create a property file with all labels you want to override, for example CustomLabels.properties and CustomLabels_de.properties.

  2. Search for the key of the property that should be changed. All the keys are documented in the ActionScript API, such as Action_withdraw_tooltip in the resource bundle class Actions_properties.

  3. In your CustomLabels bundle, set the new value for the key.

  4. In the configuration section of your Studio plugin, override the Actions_properties bundle with the following code:

//override the standard studio labels with custom properties
<editor:CopyResourceBundleProperties destination="{ResourceManager.getInstance().getResourceBundle(null, 'com.coremedia.cms.editor.sdk.actions.Actions')}"
                                     source="{ResourceManager.getInstance().getResourceBundle(null, 'com.coremedia.blueprint.studio.CustomLabels')}"/>

Example 7.11. Overriding properties


This can be done with every property of Studio. An example can also be found in the BlueprintFormsStudioPlugin.

Search Results

Table Of Contents