Message files provide localized text for certain attribute values in Task and Event objects.
Each file in a localization bundle can include an arbitrary number of lines. Each line must have the following form, where
key is any of the values that the service might assign to one of its service-specific
Task or
Event elements and
value is the localized string to display.
key=valueThe value string can contain parameters that provide the resourceId, resourceName, and resourceType of the subject of the Task or Event.
The following restrictions apply to each message file in a localization bundle:
- File contents must be encoded in the UTF-8 character set.
- key length cannot exceed 2000 UTF-8 characters.
- value length cannot exceed 2000 UTF-8 characters.
- File size cannot exceed 10MB.
- File name must be the locale code for the language used in the value strings. For example, the file containing English text must be named en_US. The file containing French text must be named fr_FR.
Whenever a localizable attribute appears in a log message,
VMware Cloud Director takes the following steps to find text to display:
- If the service has a localization bundle, open the file in that bundle whose name corresponds to the current client locale and display the value as it appears in the file.
- If the service has a localization bundle but no file exists in that bundle whose name corresponds to the current client locale, open the file in that bundle named en_US and display the value as it appears in the file. The default locale for VMware Cloud Director is en_US.
- Otherwise, display a predefined string.
Message File Keys and Parameters
Message file contents (key=value pairs) apply to all Task and Event objects that the service creates. If a Task and an Event both use the same key, the same message appears for both.
Attribute Values Matched for key | Available Parameters |
---|---|
operationName | |
Owner:type | None |
serviceNamespace | None |
operation (passthrough) | None |
To create a message that appears only when a Task has status="running", append the string _PROGRESS
to the key.
Attribute Values Matched for key | Available Parameters |
---|---|
type | |
Owner:type | None |
serviceNamespace | None |
typeFull (passthrough) | None |
To create a message that appears only for a failed Event (one where success="false"), prepend the string FAILED.
to the key.
Example Message File Content
The following lines are appropriate in the
en_US message file for a service that meets the following conditions:
- Its Namespace is registered as
org.example.vcd.backup
. - It defined a Task whose operationName attribute can have a value of
backupInProgress
. - It defined an Event whose type attribute can have a value of
backupComplete
.
org.example.vcd.backup=vCloud Backup Service backupInProgress=Backup in progress for ${resourceName} ({resourceType}) with id: {resourceId} backupInProgress_PROGRESS=Backup in progress for ${resourceName} ({resourceType}) with id: {resourceId} backupComplete=Backup complete for entity {resourceName} ({resourceType}) with id: {resourceId} FAILED.backupComplete=Backup failed for entity {resourceName} ({resourceType}) with id: {resourceId}
If the localization bundle for this service contained a file named
fr_FR that included the following line, the
Task posted in
Add a Task to an Organization's Tasks List returns this localized value for the
operationName attribute when the client locale is set to
fr_FR
. The passthrough value for
operation is not localized.
backupInProgress_PROGRESS=Sauvegarde en cours pour entity {resourceName} ({resourceType}) avec id: {resourceId}
Request:
GET https://vcloud.example.com/api/task/604
Response:
200 OK Content-Type: application/vnd.vmware.vcloud.task+xml ... <Task ... operation="Backup in progress for virtual machine with id 7b91b053-2b..." operationName="Sauvegarde en cours pour entity Finance (application/vnd.vmware.vcloud.org+xml) avec id 26 " ... >