Toolkit writers can create parameterized and localized failure message to present to the user.
Define User Messages for each Locale
The example below creates two different messages. The first ("hello") has no parameters and the second ("bye") has one parameter. We are going to create two locales for these two messages: en-us (english US) and es-US (spanish US).
cd <toolkit-directory> mkdir messages touch messages/en-us.txt cat > messages/en-us.txt <<EOF hello=Hello bye=Bye {0} EOF touch messages/es-us.txt cat > messages/es-us.txt <<EOF hello=Hola bye=Adios {0} EOF
Each <locale>.txt file must contain the same messages. This may cause the toolkit upload to fail if there are any discrepancies in the message keys between locale files.
Now that we have these messages, we can then use them in a lua script as follows:
if x == true then Fail(messages.hello()) else Fail(messages.bye("Delphix")) end
The "messages" object only has the message keys (in this case "hello" and "bye" which need to exist in all locale files). The Delphix Engine will determine which of the locale files to use, to determine which message should be displayed.