Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How translate to another language word or sentence via option scheme getting a value?

Elton2
Tera Contributor

Hi everyone, how are you?
There is the possibility of translating a text via options scheme? As attached image.

I know there is a way to use a key in gs.getMessage(" ") on the server and use that word or phrase in the "sys_ui_message_list"

 

<!--HTML-->
<div class="general-description-container">
    <div class="text-banner-container">
      <p class="text-description-banner">
        {{::c.options.text_description}} or {{::data.description_text_pt}}
      </p>
    </div>
</div>
that is, there will be a text written in the option scheme, then I would paste it inside a variable in the server, like this:

/*Server Script*/
data.description_translate = input.options.text_description
data.description_text_pt = gs.getMessage(data.description_translate)
 
but his is not working...
Could anyone support me?!
Tks
 
 
1 ACCEPTED SOLUTION

Alex Coope - SN
ServiceNow Employee
ServiceNow Employee

@Elton2,

So, the "getmessage()" method is expecting a string rather than an object, which is then parsed to find a corresponding "key" of a record in the [sys_ui_message] table. There is also a concept at play here in your example that you need to be very careful about, which is the idea of a hard-coded string. This is when the piece of text you want to be translated essentially can't be because it's not "externalised" properly,

You might find this post I did a while ago helpful on the topic,

We also have a dedicated forum for all translation related topics here as well,

Many thanks,
kind regards

--------------------------------------------------------------------
Director of Globalization Deployment, Internationalization

View solution in original post

2 REPLIES 2

Alex Coope - SN
ServiceNow Employee
ServiceNow Employee

@Elton2,

So, the "getmessage()" method is expecting a string rather than an object, which is then parsed to find a corresponding "key" of a record in the [sys_ui_message] table. There is also a concept at play here in your example that you need to be very careful about, which is the idea of a hard-coded string. This is when the piece of text you want to be translated essentially can't be because it's not "externalised" properly,

You might find this post I did a while ago helpful on the topic,

We also have a dedicated forum for all translation related topics here as well,

Many thanks,
kind regards

--------------------------------------------------------------------
Director of Globalization Deployment, Internationalization

Elton2
Tera Contributor

Hi @Alex Coope - SN , how are you?!

Thanks for your support, this information will be helpful for me.

Thanks again!!!