- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2023 12:15 AM
Hello Everyone,
I want to translate the URL Title text. Below is the email script. In the below script I want to translate the text "" in different language. Can I use "gs.getMessageLang()" here and if yes how can I do it?
Email Script:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
var language = current.user.preferred_language;
template.print('<p><span style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"><a href="/esc?id=take_survey&instance_id=${sys_id}"><strong>Take the User Satisfaction Survey</strong></a></span></p>');
})(current, template, email, email_action, event);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2023 04:50 AM
Yes, you can use "gs.getMessageLang()" to translate the text in different langages.
Here's an updated version of the email script that uses "gs,getMessage()" method to retrieve the translates message:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
var language = current.user.preferred_language;
gs.setRedirectURL(current);
template.print('<p><span style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"><a href="/esc?id=take_survey&instance_id=${sys_id}"><strong>' + gs.getMessage("Take the User Satisfaction Survey", null, language) + '</strong></a></span></p>');
})(current, template, email, email_action, event);
In this updated script, we pass the message key "Take the User Satisfaction Survey" to the "gs.getMessage()" method along with the language parameter obtained from the "current.user.preferred_language" field. The method then returns the translated message based on the specified language.
Make sure to create message translations for all languages you want to support in the "System UI > Messages" table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2023 01:14 AM
Hi,
I would look into the option to use translated email notifications introduced in Tokyo.
Here are some good resources to get you started:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2023 04:17 AM
Yes, you can use gs.getMessageLang() (but if you do use translated e-mails you need to use gs.getMessage().
However
var language = current.user.preferred_language;
is most likely wrong.
In order to tell you how you could arrive to the proper language, one would need to know which table current represents and how the recipient is determined.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2023 04:50 AM
Yes, you can use "gs.getMessageLang()" to translate the text in different langages.
Here's an updated version of the email script that uses "gs,getMessage()" method to retrieve the translates message:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
var language = current.user.preferred_language;
gs.setRedirectURL(current);
template.print('<p><span style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"><a href="/esc?id=take_survey&instance_id=${sys_id}"><strong>' + gs.getMessage("Take the User Satisfaction Survey", null, language) + '</strong></a></span></p>');
})(current, template, email, email_action, event);
In this updated script, we pass the message key "Take the User Satisfaction Survey" to the "gs.getMessage()" method along with the language parameter obtained from the "current.user.preferred_language" field. The method then returns the translated message based on the specified language.
Make sure to create message translations for all languages you want to support in the "System UI > Messages" table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 07:36 AM
Hi @Arjunsuhass ,
Could you please help me how to use "gs.getMessage()" for the below part of email script.
I have posted a new question here