- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2016 05:35 AM
var ret = ' ';
....
....
if(counter_app == 0){
switch(counter_level){
case 0:
ret += "First level of approval "; // <------ how to get such string translated?
break;
....
}
if (when.indexOf('always') == -1)
ret += '\(Depends on selected options)\: '; <--------- how to get such string translated too?
else ...
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2016 05:41 AM
Sorry Anna,
I thought you were doing a client script.
For server side scripts (business rules, UI actions, etc) there's no Messages field and you use the gs.getMessage() call.
For best results, go to System UI> Messages and create your translated messages. For example,
key=first_level_of_approval, Message=First level of approval
Now in your script...
ret += gs.getMessage('first_level_of_approval');
This may also be helpful: gs.getMessage() - The Second Parameter

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2016 05:41 AM
Sorry Anna,
I thought you were doing a client script.
For server side scripts (business rules, UI actions, etc) there's no Messages field and you use the gs.getMessage() call.
For best results, go to System UI> Messages and create your translated messages. For example,
key=first_level_of_approval, Message=First level of approval
Now in your script...
ret += gs.getMessage('first_level_of_approval');
This may also be helpful: gs.getMessage() - The Second Parameter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2016 06:13 AM
yes, thank you!
Works great and as expected.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2016 06:18 AM
I use it all the time. Here's a little secret...
You do not NEED the translated message in the System UI> Messages table. Most people just use something like:
var msg = gs.getMessage('You made a mistake');
If no entry is found in the sys_ui_message table, it will simply use "You made a mistake" otherwise, THAT is the key if you do other translations.
That's how lazy people do it. My feeling, however is to use an "ugly" key in the gs.getMessage() call like this:
var msg = gs.getMessage('mistake_message');
Now if there's no key in the sys_ui_message table, it uses 'mistake_message'. If I see that in a notification, screen message, etc. I know "HEY! I forgot to put something in the sys_ui_message table!" Why do I take the extra step? Because when it comes time to translate things from English to any other language, I already have a starting point with the entries in sys_ui_message. If I didn't have them, I would have to start searching scripts to gs.getMessage() calls and ensure there is a corresponding key/message pair record there - which lazy people didn't do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2016 07:43 AM
You're absolutely right. In a long run it is much more efficient, especially i saw it today, while doing translation for different languages.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2017 03:47 AM
Hi Chuck ,
Can we translate the level of variables of a catalog item in this way, or there is any better recommended way??