Optaining user language in a catalog script with g_user?

jesusemelendezm
Mega Guru

Hi, I need to display a msg if user language is "English". I am working with Var loginLanguage = g_user.getClientData("loginlanguage"); but the language value is undefined? my current language is English. Any help is appreciated.

1 ACCEPTED SOLUTION

Jim Coyne
Kilo Patron

There's a global variable called "g_lang" that you can use.   The value would be "en" for English.



e.g. alert(g_lang) will display "en" in an alert dialog.


View solution in original post

20 REPLIES 20

I am just trying to get choice lists built according to the users language.



ive tried this with no luck



function onChange(control, oldValue, newValue, isLoading) {


if(newValue == oldValue){


return;


}


//remove all items from subcat drop down to start


// Used the g_form.clearOptions() function instead of g_form.removeOption() function


g_form.clearOptions('desktop_type');



//build a new list of dependent options


var gp = new GlideRecord('sys_choice');


gp.addQuery('dependent_value', newValue);


gp.addQuery('element', 'u_type_of_work');


gp.addQuery('language', g_lang);


gp.query();


while(gp.next()){


  g_form.addOption('desktop_type', gp.value, gp.label);


}


}




any advice?