Location: PHPKode > scripts > Photos > photos/objects/class.language.inc.php
<?php

// This file is part of Photos
// Copyright (c) 2001-2004 Alex King
// see LICENSE.txt for more information

// Language class, used for localization

class language {
	var $author;		// name of the translator
	var $author_url;	// URL of the translator
	var $charset;		// defaults to ISO-8859-I for english
	var $name;			// name of language
	var $strings;		// the strings that are translated
	
// initialize
	function language($author = ''
	                 ,$author_url = ''
	                 ,$charset = 'ISO-8859-I'
	                 ,$name = ''
	                 ,$strings = array()
	                 ) {
		$this->author = $author;
		$this->author_url = $author_url;
		$this->charset = $charset;
		$this->name = $name;
		$this->strings = $strings;
	}

// return or print a translated string
	function str($key, $vars = array(), $action = 'ret') {
		if (!isset($this->strings[$key])) { // not using array_key_exists() because it is slower
			return false;
		}
		if (empty($vars)) {
			if ($action == 'print') {
				print($this->strings[$key]);
				return true;
			}
			else {
				return $this->strings[$key];
			}
		}
		else {
			$string = $this->strings[$key];
			for ($i = 0; $i < count($vars); $i++) {
				$string = @str_replace("__".$i, $vars[$i], $string);
				if (!$string) {
					print('<p><strong>Error</strong>, could not replace __'.$i
						 .' with '.$vars[$i].' in string '.$key.'.</p>'
						 );
				}
			}
			if ($action == 'print') {
				print($string);
				return true;
			}
			else {
				return $string;
			}
		}
	}
}

?>
Return current item: Photos