My page is available in 3 languages and I'm including in the header of each file (index, contact, etc.) the selected language file (en, ru, pl).
<?php
session_start();
include('language/'.$_SESSION['lang'].'.php');
?>
en.php
<?php
session_start();
$lang = array();
$lang['hello'] = 'Hello';
$lang['world'] = 'World !';
?>
ru.php
<?php
session_start();
$lang = array();
$lang['hello'] = 'привет';
$lang['world'] = 'мир';
?>
And this is how I'm echoing them:
<p><? echo $lang['hello'].' '.$lang['world'];?></p>
This is working actually fine, but I'm having problem with my .js files. If I want to alert or insert some text somewhere I can't.
For example in one of my .js file I have an alert:
if (something_obj.val() == ''){
alert('Wrong username given !');
return false;
}
How can I implement language files in my js files? Am I need to create a news .js language file?