How to translate email script message into Germany

Gopal14
Tera Contributor

Hi Team,

 

I want to translate email script message.  I have tried in Messages(sys_ui_message) module, However it is not working.

 

I have closed case notification, in that every text got translated, expect email script one. email script is for survey. that survey message is showing in English, Now I want to translate that also into Germany. 

 

below is my email script:

 

 var email_to = gs.getProperty('instance_name')+"@service-now.com"; 

    var out = '<p><span style="font-size: 12pt; font-family: verdana, geneva;">Issue resolved? Take this quick survey!</span></p>' +
              '<p><span style="font-size: 12pt; font-family: verdana, geneva;">How did we do? Rate your service experience</span></p>' +
              '<p>' +
              '<a href="mailto:' + email_to + '?subject=re: ' + current.number + ' CSM CSAT Survey - Very Dissatisfied &amp;body=additional comments (optional):">' +
              '<img style="align: baseline;" src="sn_customerservice.VeryDissatisfied-Selected.jpg" alt="Very Dissatisfied" height="auto"/></a>' +
              '<a href="mailto:' + email_to + '?subject=re: ' + current.number + ' CSM CSAT Survey - Dissatisfied &amp;body=additional comments (optional):">' +
              '<img style="align: baseline;" src="sn_customerservice.Dissatisfied-Selected.jpg" alt="Dissatisfied" height="auto"/></a>' +
              '<a href="mailto:' + email_to + '?subject=re: ' + current.number + ' CSM CSAT Survey - Neutral &amp;body=additional comments (optional):">' +
              '<img style="align: baseline;" src="sn_customerservice.Neutral-Selected.jpg" alt="Neutral" height="auto"/></a>' +
              '<a href="mailto:' + email_to + '?subject=re: ' + current.number + ' CSM CSAT Survey - Satisfied &amp;body=additional comments (optional):">' +
              '<img style="align: baseline;" src="sn_customerservice.Satisfied-Selected.jpg" alt="Satisfied" height="auto"/></a>' +
              '<a href="mailto:' + email_to + '?subject=re: ' + current.number + ' CSM CSAT Survey - Very Satisfied &amp;body=additional comments (optional):">' +
              '<img style="align: baseline;" src="sn_customerservice.VerySatisfied-Selected.jpg" alt="Very Satisfied" height="auto"/></a>' +
              '</p>';

   
    current.survey = "0";
    current.update();
    template.print(out);

 

Now I want to translate 

"Issue resolved? Take this quick survey!"  to  "Problem gelöst? Nehmen Sie an dieser kurzen Umfrage teil!"
 
"How did we do? Rate your service experience" to "Wie fanden Sie uns? Bewerten Sie Ihr Serviceerlebnis"

 

In Messages table it is not working? Is there any other way to achieve this?

 

5 REPLIES 5

Swapna Abburi
Mega Sage
Mega Sage

Hi @Gopal14 

Try using gs.getMessage('issue.resolved.email');

create Message entries in sys_ui_message table with key = issue.resolved.email and text in English and German languages.

 

For example: 

var out = '<p><span style="font-size: 12pt; font-family: verdana, geneva;">gs.getMessage('issue.resolved.email');</span></p>'

 

Hi @Swapna Abburi 

 

 

No it is not working

 

 

Gopal14_0-1748508778235.png

 

 

Gopal14_1-1748508816062.png

 

 

 

 

yesubabu Jonnal
Tera Contributor

Hi Gopal ,

 

You can use the 'g_lang' variable to get the user language i.e.: g_form.setValue('language',g_lang);

based on that you can use the message translation

 

Ref my client script 

 
var lang = g_lang;
create two messages in sys_ui_message module
1.in english
2. in Germany
if (lang = en){use 1.in english }
if(lang =Germany){use 2. in Germany}
---------------------------------------------------REF example code in client script
var lang = g_lang;
if (lang == "fq") {
                        g_form.showFieldMsg('please_select_travel_start_date', getMessage("Pour les demandes de voyage soumises dans les 24 heures précédant le départ, l'approbation de votre gestionnaire est requise ci-dessous."),'error');
                    } else {
                        g_form.showFieldMsg('please_select_travel_start_date', getMessage("For travel requests submitted within 24 hours of departure, your manager's approval is required below."), 'error');

Ankur Bawiskar
Tera Patron
Tera Patron

@Gopal14 

did you create entry into messages table for that message with correct language?

use this to get that message in that particular language

1) get the language of that recipient user

2) then use this to get that message in that language

// determine the language of that recipient user

gs.getMessage("Take the User Satisfaction Survey", null, language);

Also check this

Return a message in a specific language, gs.getMessageLang() 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader