Creating multilanguage homepage
<p>so im making homepage with three languages.
I am using switch method, here is code - </p>

<pre><code>  public function languages()
{
if (isset($_GET['lang']) &amp;&amp; $_GET['lang'] != '')
{
  $_SESSION['lang'] = $_GET['lang'];
}
else
{
  $_SESSION['lang'] = 'en_EN';
}
switch($_SESSION['lang'])
{
  case 'en_EN': require_once('language/lang.eng.php');break;
  case 'lv_LV': require_once('language/lang.lv.php');break;
  case 'ru_RU': require_once('language/lang.ru.php');break;
  default: require_once('language/lang.eng.php');
}
}

public function translate($txt)
{
  global $text;
  return $text[$txt];
}
</code></pre>

<p>and it should display in index.php file like this - </p>

<pre><code>&lt;?php $index-&gt;translate('search'); ?&gt;
</code></pre>

<p>but the problem is that it shows no errors, no notices, no warnings and no translated or default text.
I included function languages() , maybe you can help me with this problem?</p>

<p>EDIT: 
im calling $language at start of index.php file - <code>&lt;?php require_once('class.index.php'); $index = new index; $index-&gt;languages(); ?&gt;</code> and $text is defined in lang.eng.php; lang.lv.php and lang.ru.php file. </p>
