Creating multilanguage homepage translating
<p>Okay, so i got class file, in which i got function - </p>

<pre><code>var $text;                     

public function languages()
{
  if (isset($_GET['lang']) &amp;&amp; $_GET['lang'] != '')
  {
    $_SESSION['lang'] = $_GET['lang'];
  }
  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');
  }
  $this-&gt;text = $text;
}

public function translate($txt)
{
  if(isset($this-&gt;text[$txt]))
  {
    return $this-&gt;text[$txt];
  }
}
</code></pre>

<p>If i am translating via index.php like this - > <code>echo $index-&gt;translate('search');</code> it translates ok, but if i am translating something in class file for example -</p>

<pre><code>if ($country_rows &gt; 0)
{
  $_SESSION['country'] = $_GET['country'];
}
else
{                                                      
  $_SESSION['country'] = $this-&gt;translate('all_countries');
}
}
if ($_SESSION['country'] == '')
{ 
  $_SESSION['country'] = $this-&gt;translate('all_countries');
}
</code></pre>

<p>it doesn't show up.
In index.php header i got included - </p>

<pre><code>require_once('class.index.php');
$index = new index;
$index-&gt;get_country();
$index-&gt;languages();
</code></pre>

<p>What could be the problem, and how can i fix it, so i can translate everything inside class file too? will appreciate your help!</p>
