Categories
IBM PureApplication System IBM SmartCloud Application Services

Pattern-type (Part 19): internationalization and localization of Pattern-type

When you create a new plugin, you could have noticed that a “locales” directory is created by the plug-in project wizard in the appmodel directory. This directory can contains the messages in different languages. Here how it works.Here the structure of the appmodel directory:SCAWS internationalization and localization localesThe messages.json in the locales directory is the default value to all message reference. This file is a JSON object of key/value pairs. The key will be the reference key for the message and the value the string to display.
The messages.json files located in the sub-directories will be used depending on the browser settings (ie: fr, en, es,….).

Here an example:
The default messages.json contains for example:
{
“MASTER_LABEL”:”Master”
}

The fr/messages.json contains for example:
{
“MASTER_LABEL”:”Maitre”
}

How to reference them:
For example if I use the message key in a label of a metadata.json as:
[
{
“id”: “Master”,
“type”: “component”,
“attributes”: [
{
“id”: “myString”,
“type”: “string”,
“required”: false,
“label”: “My String”
}
],
“label”: “MASTER_LABEL”
}
]

and if I setup my browser for french language, I will see in the VAB while selecting the Master component:
SCAWS Internationalization and localization Master French

Leave a Reply

Your email address will not be published. Required fields are marked *