Studio Developer Manual / Version 2107
Table Of ContentsMany 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:
Create a directory corresponding to the desired package of your resource bundle, for example
<ModuleName>/src/main/joo/<PackagePath>
.Create new properties files following the naming schema:
<PropertyFileName>.properties
and<PropertyFileName>_de.properties
.Add one or more keys and values in the form
<KeyName>=<PropertyValue>
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.
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
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.Instead of using the
ResourceManager.getInstance()
singleton, you can reference theresourceManager
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:
Create a property file with all labels you want to override, for example
CustomLabels.properties
andCustomLabels_de.properties
.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 classActions_properties
.In your
CustomLabels
bundle, set the new value for the key.In the
configuration
section of your Studio plugin, override theActions_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
.