Virtual Agent and localization

yundlu316
Kilo Guru

Hi Experts, our team is completely new to Virtual Agent and have a few questions regarding localization.  One of the first questions we want our Virtual Agent to ask is for the user to select their preferred language.  From there we have a Decision Utility that splits off into all the languages we want to incorporate.  Once a user selects Spanish for example, we would like all of the subsequent questions and selections to translate to Spanish. To test this, we currently have a Bot Response - Script Output that looks like this:

find_real_file.png

In the Messages table, we created the following entry:

find_real_file.png

When previewing and choosing Spanish, the Virtual Agent still responds in English:

find_real_file.png

Are we missing any steps to have this return "Hola David!" instead?  Additionally, if we wanted all subsequent questions to be in Spanish, what steps would we need to take to achieve this?  If one of the languages we want to incorporate is not available as a plugin, is it possible to translate as well?

Any guidance on this is greatly appreciated.

1 ACCEPTED SOLUTION

Can you try changing the language under the user settings? Instead of the preferred language field on the user record?

find_real_file.png

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

15 REPLIES 15

Thank you so much for explaining all of this Mark.  I guess we're still confused about the differences between gs.getMessage vs. gs.getMessageLang.  We're happy to use gs.getMessageLang since it's working, but what exactly does gs.getMessage do?  Does it translate at all? From all the documentation we've read, it seems like it should translate everything according to a user's preferred language, but we have yet to see it translate anything.  Can you help provide some clarity on gs.getMessage?  Thanks again.

gs.getMessage works 100%. If there's a matching UI Message (key and language), that UI Message will be applied. 
gs.getMessage is also the most common way, gs.getMessageLang isn't used that much. gs.getMessage with Virtual Agent also does not need so much work, while gs.getMessageLang does need a lot of work to get applied.

It's just that you are trying to switch the users language scripted which not works correctly.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hi @Mark Roethof , thank you again for taking all this time to troubleshoot this with us.  I sincerely appreciate all the effort you've spent and your patience!

To test, I took away everything except for our Greeting: 

find_real_file.png

Then, I switched my preferred language directly on the sys_user table:

find_real_file.png

I changed gs.getMessageLang back to gs.getMessage for our Greeting code:

return gs.getMessage('Hello, {0}', [vaInputs.user.first_name]);

 

However, when we preview it, it still shows Hello, David and not Hola: David

find_real_file.png

I made sure the following plugins are installed:

find_real_file.png

Are we missing something that would prevent gs.getMessage from working?

Can you try changing the language under the user settings? Instead of the preferred language field on the user record?

find_real_file.png

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

oh man....that did it!  So gs.getMessage goes off of the language selection there and not on sys_user.  Thanks so much for this clarification!