This topic is locked

Detect Language automatically works but $_SESSION["language"] is empty unless user changes language

3/15/2016 8:29:20 AM
PHPRunner General questions
G
gustavo author

A bit of a problem with Detect Language automatically

The automatic language detect works as expected but the problem is that $_SESSION["language"] remains empty unless user changes language.

Therefore, selective lookup base on language "language='". $_SESSION["language"] ."'" doesn't work. Unless the user click the language button to change language which is unlikely because the automatic language detect already put his menu on his language base on the language of his browser.
I wonder what is the name of the global variable that stores the automatic detect language on PHPRunnner? So I can put the value on $_SESSION["language"] and make the conditional lookup works

Thank You

Sergey Kornilov admin 3/16/2016

You can probably populate session variable $_SESSION["language"] in one of events on your landing page. Something like this:

if ($_SESSION["language"]=="")

$_SESSION["language"]="English";
G
gustavo author 3/17/2016



You can probably populate session variable $_SESSION["language"] in one of events on your landing page. Something like this:

if ($_SESSION["language"]=="")

$_SESSION["language"]="English";



It seems the problem has not been understood clearly.

Yes, I know I can set the value of the $_SESSION["language"] ="user's language" if $_SESSION["language"] =""; but how can we know at that point what is the language the user uses if he variable is empty. It could be English, Spanish, French ...

Sergey Kornilov admin 3/17/2016

This code only sets language if this session variable is empty meaning that no language was selected yet.
If this is not what you looking for you need to explain it better. It's really confusing at the moment.