How can I get the login language by code?

yan0721
Kilo Explorer

hi teams,

At the login page, i choose a language like 'zh', how can i get this value by codes when i need to check what the exact value of the login language?

Appreciate your feedback.

Sincerely,

Lydia

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

where do you require to get this? Is it server side or client side?

for server side use this

var language = gs.getUser().getLanguage();

for client side; onload, onchange script

var language = g_lang; // for English it would give en

alert(language);

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

where do you require to get this? Is it server side or client side?

for server side use this

var language = gs.getUser().getLanguage();

for client side; onload, onchange script

var language = g_lang; // for English it would give en

alert(language);

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader


var language = g_lang;


Hi there,

about the variable g_lang,

is that a global variable in client script?

i think there are more global variables in client script, so is there any document about all of them? 

No documentation available as such.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

thanks for answering.

would you mind to share with me the global variables you know as many as you can?