Localizing Labels - CMCC 10

Last updated 3 years ago

Maybe you are already familiar with localizing labels of document types and property names in Studio. But there are many other labels besides these two that can be localized as well. Find out more about this feature during your Studio customization process.

This guide applies to CMCC 10

This how-to guide has yet to be updated for the most recent product release. Some of the elements in this guide might not work as described, if you are on the latest version.

Thank you for your patience!

LightbulbWhat you'll learn

  • Adding new resource bundles
  • Overriding standard Studio labels

Person reading a bookPrerequisites

  • A Blueprint workspace

WristwatchTime matters

Reading time: 5 to 10 minutes

Person in front of a laptopShould I read this?

This guide is for Developers.

Localizing Labels

In general, you can localize all labels in CoreMedia Studio. Typical cases are document type names and document property names but also labels or button texts, error messages or window titles. The localized texts are stored in properties 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 the Studio Developer Manual 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 properties files of Blueprint Studio

The blueprint-forms Studio plugin contains several properties 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 properties files.

Adding a new resource bundle

If you want to add a new properties 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 scheme: <PropertyFileName>.properties and <PropertyFileName>_de.properties.

  3. Add one or more keys and values in the format <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 an MXML file describing your custom component, import the resource bundle in the metadata section:

  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

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.

        <Button itemId="exampleButton">
            <editor:ShowCollectionViewAction published="false"
        <Button itemId="{FavoritesToolbar.NEW_MENU_BUTTON_ITEM_ID}"/>

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


Override Standard Studio Labels

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

  1. Create a properties 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')}"/>

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

Copyright © 2024 CoreMedia GmbH, CoreMedia Corporation. All Rights Reserved.