Authoring Virtual Agent conversations for localization
-
- UpdatedJan 30, 2025
- 2 minutes to read
- Yokohama
- Virtual Agent
Use localization methods in your Virtual Agent scripts to ensure that the content can be translated. Localization methods are designed to show the original text when no translation is found. These methods can be applied to your code before you have created translations.
Localization method for message content
The gs.getMessageLang
method checks the Message table [sys_ui_message] for
a translated version of the text in the language selected for the current user. If a
translated version isn't found, the default language (English) is returned.
This code provides a greeting that dynamically adds the value of the
first_name
variable.
The following example shows that same code rewritten for localization.
The second example uses the gs.getMessageLang
method. The text is the same
as the previous example, but the format is changed. The number in brackets acts as a
placeholder for the variable, which is then listed in an array after the comma:
[vaInputs.first_name]
. The gs.getMessageLang
method
searches for a record on the Message table with a key value matching Hi there
{0}
and a language value matching the requester's language. The method returns
the translated version of the text, which is stored in the Message
field of the record.
