Location: PHPKode > scripts > GrWebLang > grweblang/grweblang.class.php
<?php
/*
	GrWebLang 0.1 pre-alha - Multilanguage Website Php Class from GrClass project.
	---------------------------------------------------------------
	http://sourceforge.net/projects/grclasses/
	
	Under GNU/GPL.
	---------------------------------------------------------------
	Change log:
	---------------------------------------------------------------
	6/10/2004 - First Version: 0.1 pre-alpha
	---------------------------------------------------------------
	Build by Garry Lachman.
*/
class grweblang {
	var $lab;
	var $lang;
	var $trans;
	var $lastid;
	var $encode;
	var $dir;
		
	function Start() {
		$this->lastid = 0;
	}
	
	function AddDir($dir, $lang) {
		$this->dir[$lang] = $dir;
	}
	
	function Dir($lang) {
		$dir = $this->dir[$lang];
		return $dir;
	}
	
	function AddEncode($encode,$lang) {
		$this->encode[$lang] = $encode;
	}
	
	function Encode($lang) {
		header("Content-Type: text/html; charset=" . $this->encode[$lang] . "");
	}
	
	function AddLab($lab,$lang,$trans) {
		if ($this->lastid >= 0) {
			$id = ($this->lastid + 1);
		}
		else
		{	
			$id = 0;
		}
		$this->lab[$id] = $lab;
		$this->lang[$id] = $lang;
		$this->trans[$id] = $trans;
		$this->lastid = $id;
	}
	
	function Trans($lab,$lang) {
		$lastid = $this->lastid;
		$num = 0;
		while($num <= $lastid) {
			if ($this->lang[$num] == $lang && $this->lab[$num] == $lab) {
				$result = $this->trans[$num];
			}
			$num = $num + 1;
		}
		return $result;
	} 

}
Return current item: GrWebLang