Is there a way to get the display value for a language besides the current language?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2013 07:25 AM
I know by using .getDisplayValue() will return the display value for the currently selected language, but I am looking for a way to get the display value for a different language. For example, I want to get the German display value no matter what language I have selected as my preference.
Thoughts?
Thanks,
Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2013 09:57 AM
I don't know of a way to get it directly, but you could do the following:
var lang = gs.getSession().getLanguage(); // puts the user's current language in a variable
gs.getSession().setLanguage("es"); // sets the session language to whatever you want, this one is Spanish
gs.print(gr.title.getDisplayValue()); // prints the Spanish translation of the "title" field of the GlideRecord variable "gr"
gs.getSession().setLanguage(lang); // sets the langauge back to what it was
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2014 01:23 PM
Interesting approach. Since we only have 3 languages available I believe we just did the following:
if(value == '<english value>' || value == '<german value>' || value == '<french value>')
...instead of:
var translation = <code to get translation of the field value>;
if(value == translation)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2024 04:17 AM
Hi @CapaJC
I have been trying below script , but the value of the producer short description is still in session language . Could you please help .
var lang = gs.getSession().getLanguage();