Translation of table fields

anirban300
Kilo Guru

I have a field "Hardware" which has few dropdowns. These dropdowns are coming from a table.Now I want to translate these dropdown options into different languages.Should it be done in "sys_translated" table.If yes then what should be the field values?

4 REPLIES 4

Chuck Tomasi
Tera Patron

Hi Anirban,



Normally choices come from the sys_choice table which has a language field in it. Adding new choices with the new language is the easiest way to do that.



It sounds like this may be a reference field displayed as a choice. If that's the case, you'll need to add a language field to your table and appropriate entries, then use a reference qualified to display the right choices to the person at the right time. That gets a little more complex, but is still do-able. Again, sys_choice is your first choice.



Reference Qualifiers


Hii Chuck



I have done according to what you say but I have the below query



Stream(u_stream)


Language(u_language)


Value(u_value)


Networken1
Сетьru1
Netzwerkde1


Suppose we have the above table and we have a field "Select(test_select)" in a record producer.Now for different language, user will get the values in different languages i.e. if language set in their profile is Russian then "Network" will appear as "Сеть". But when the ticket is submitted then in the description of the ticket the selected value should appear in English.



I have written the following piece of code in the record producer but its not working.Please guide me.



var issue = producer.test_select.getDisplayValue();


var gr=new GlideRecord('u_table');


gr.addQuery('u_stream',issue);


gr.query();


if(gr.next())


{


var value=gr.u_value;



gr.addQuery('u_language',"en");


gr.addQuery('u_value',value);


gr.query();


if(gr.next())


{


var stream=gr.u_stream;


if(stream != '') {


  current.description = "This issue is related to: "+stream+"\n"+current.description;


}


}


}


I'm not seeing anything immediate jump out at me (but it's still early here.) My recommendation would be to create script include that you can call that does the hard work for you. I suspect you are going to need this multi-lingual functionality in more places than just the record producer.



Putting it in a script include makes it much easier to write and test, and makes the usage in the record producer, and other server side scripts simpler to understand.



Your script include could have methods like:



var s = getStream(value, lang); // pass in a value and language and get the display value


var v = getValue(stream, lang); // pass in a stream and language and get the value



Those are just examples. You may have more use cases.