Work with translation variables
This tutorial will show you how to work with translation variables with a simple example.
A translation variable is a text string that changes depending on the culture setting of the reader.
After the tutorial watch this video for further details on how to work with translation variables.
Step 1: Create an empty service
If you aren't sure on how to do this follow the steps in this tutorial.
Step 2: Create a translation variable
- Go to the variables tab in the service editor
- Click on Create new variable
- On Name write translation
- On Type choose Translation
Step 3: Create a new activity that supports translation variables
If you do not know how to create a basic activity follow the steps in this guide first and the continue with the steps below.
- Add the following function in your activity module:
function Get-ExampleTranslation($config)
{
$returnHash = @{}
$translation = @{}
$translation['en-US'] = "Message in English."
$translation['sv-SE'] = "Meddelande på Svenska."
# Add more cultures if needed
$returnHash.translation = $translation
return $returnHash
}
- Make sure the function is included in modules to export.
- Restart ProvisioningSystem or wait for an inventory cycle to run.
Step 4: Create a simple workflow with the new activity
Create a workflow with the newly created activity and a State activity.
Bind the state activity to the translation variable.
Save the service.
Step 5: Order the service
Result when ordering the service as a user with Swedish culture:
Result when ordering the service as a user with English culture:
The culture can be changed from you profile page in Zervicepoint.