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

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.


that solved my issue, where did you get that? I didn't see it on the wiki.


There are a number of global variables that we can take advantage of.   Right-click on a page and select your browser's "Inspect Element" menu (or similar).   You can find them at the top of the document or search for "g_lang".


Untitled.jpgI saw it 🙂