You can translate the name and description for a pattern component by
using messages.json files.
Before you begin
You must use the Plug-in Development Kit (PDK)
Eclipse plug-in that is included with Cloud Pak System Software 2.1
or later to complete this task. Updating the files for a pattern component with
a different tool, such as a text editor, is not supported. For more
information about installing the PDK, see the Related reference.Avoid trouble: Pattern components must
be created and updated through the console. The
only supported customizations for pattern components through
the PDK are the steps that are described in this task: add a messages.json file,
build the pattern component to
include that messages.json file, and import the pattern component to
the system. Any other customizations to pattern components that
are made through the PDK are not supported.
Procedure
- Export the pattern component from
the system.
- Import the pattern component to
the Plug-in Development Kit.
One method is to click from the Plug-in Development Kit. Browse
to the file that you exported in Step 1 and click Next.
Select a project (pattern type, plug-in, software component, or script
package) and click Finish.
The files for the pattern component are
now available in a folder that is named patterncomponents in
the project that you selected.
- Modify the values for description and label attributes
in metadata.json to use keys for the values.
For example, if
metadata.json currently
contains:
[
{
"attributes": [
... ],
"builder": true,
"category": "application",
"description": "TradeLite application running on tWAS PC",
"displayId": "TradeLiteWASPC",
"extends": "PATTERNCOMPONENT",
"id": "patterncomponents:TradeLiteWASPC",
"image": "\/images\/vsys\/VS-Component_64.png",
"label": "Sample TradeLite WAS application pattern component",
"outputs": [
],
"thumbnail": "\/images\/vsys\/VS-Component_64.png",
"type": "component"
}
]
Change the values for
description and
label:
[
{
"attributes": [
... ],
"builder": true,
"category": "application",
"description": "DESCRIPTION",
"displayId": "TradeLiteWASPC",
"extends": "PATTERNCOMPONENT",
"id": "patterncomponents:TradeLiteWASPC",
"image": "\/images\/vsys\/VS-Component_64.png",
"label": "LABEL",
"outputs": [
],
"thumbnail": "\/images\/vsys\/VS-Component_64.png",
"type": "component"
}
]
- Create a folder that is named locales at
the same level in the directory structure as metadata.json and config.json in
the patterncomponents folder.
- In the locales folder, create subfolders
in
ISO 3166-1 alpha-2
format that contain the messages.json file
for each language that your pattern component supports.
For example, if your pattern component supports
English and French, your patterncomponents folder
should contain these directories and files:
GlobalizationTest\1.0.0.0\locales
GlobalizationTest\1.0.0.0\locales\messages.json (This file contains the default values for the label and description.)
GlobalizationTest\1.0.0.0\locales\en
GlobalizationTest\1.0.0.0\locales\en\messages.json (This file contains the values for the label and description in English.)
GlobalizationTest\1.0.0.0\locales\fr
GlobalizationTest\1.0.0.0\locales\fr\messages.json (This file contains the values for the label and description in French.)
GlobalizationTest\1.0.0.0\config.json (Do not modify this file.)
GlobalizationTest\1.0.0.0\metadata.json (Do not modify this file.)
If
metadata.json contains:
[
{
"attributes": [
... ],
"builder": true,
"category": "application",
"description": "DESCRIPTION",
"displayId": "GlobalizationTest",
"extends": "PATTERNCOMPONENT",
"id": "patterncomponents:GlobalizationTest",
"image": "\/images\/vsys\/VS-Component_64.png",
"label": "LABEL",
"outputs": [
],
"thumbnail": "\/images\/vsys\/VS-Component_64.png",
"type": "component"
}
]
Then,
messages.json should
contain:
{
"LABEL":"Test label for globalization",
"DESCRIPTION":"Test description for globalization"
}
The
messages.json in the folder
for each language should have these values in the language that is
specified by the folder.
- Build the pattern component.
- Select the pattern component.
- Right-click and select .
The pattern component is built.
- Install the updated pattern component to
the system.
- Select the pattern component.
- Right-click and select .
Note: You must have a test environment
configured in to complete this step.