language translation in catalog client script

ujjwal0306
Giga Expert

In the Service Catalog Variable XYZ values are dependent on the variable ABC values. To populate the values in XYZ dynamically I've used a catalog client script. I did not create any choice in catalog items for XYZ. Now the requirement is the variables need to be translated in different languages. I've translated most of them but the choice list in XYZ is not translated as they are dynamically created using catalog client script. How to translate the values in the catalog client script in different languages?

1) We can do it manually by scripting the translated choice list. But, it is time consuming.

Is there any way to achieve this?

Note: Values in XYZ are visible based on the values selected in ABC. Catalog script is used to display those values.

1 ACCEPTED SOLUTION

This was not working. But I figured out a way to translate the dynamic variables, we can translate it in the messages and use getMessage(); the values can   be translated.


View solution in original post

7 REPLIES 7

Sai Anna
ServiceNow Employee
ServiceNow Employee

Hi Ujwal,



I will recommend values to be moved to a choice table or custom table and then get values dynamically in catalog client script rather than hard coding values in the script. by doing this, you can translate them like choices and easy maintenance going forward. I don't think there is an easy way for translating hard coded values in the script other than writing few extra lines of code.






Thanks,


Sai


This was not working. But I figured out a way to translate the dynamic variables, we can translate it in the messages and use getMessage(); the values can   be translated.


Hi Ujjwal,

I have same requirement and tried the same thing but not working can u please help me out.

 

I have created messages in sys_ui_message.

find_real_file.png

I am using this in catalog client script as below:

find_real_file.png

 

Hi Ujjwal, thanks for that. Just a bit of clarification, did you add the message to be translated in the 'sys_ui_message' table in the 'message' field and passing the key to the getMessage() method?