I'M developing a site in php
. I have set the language session $_SESSION['language'] = 'english'
and I have included the language file according to the setted session. In php everything is fine and no issue.
The issue is I am using jquery validator plugin. And I want to return the validation errors according to the current language session. blow is a little code snidest.
code of english lang file.
` $lang = array();
$lang['0'] = "Home";
$lang['1'] = "Join";
$lang['2'] = "Sign In";
$lang['3'] = "close";
$lang['4'] = "Email";
$lang['5'] = "Choose Username";
$lang['6'] = "Choose Password";
$lang['7'] = "Are You Human?";`
for example if I need home somewhere in page I just do
echo $lang['0'];
in php its fine. but how can I accomplish this in .js
P.S I know the solution like write you javascript code in .php
file please tell me is there any alternate way to do this or is there any way to import php array into javascript like jsonencode
Thanks