registry =& $registry; } // ################################################################### /** * (PHP 4) Constructor */ function Localize(&$registry) { $this->__construct($registry); } // ################################################################### /** * Initializes the localization system with a table * * @access public * * @param array Localization table */ function init_with_table($table) { $this->localtable = $table; } // ################################################################### /** * Returns a localized string from the table * * @access public * * @param string Text to localize * * @return string Localized string */ function string($key) { if (defined('ISSO_LOCALIZE_DEBUG')) { return '[@"' . $key . '"]'; } if (isset($this->localtable["$key"])) { return $this->localtable["$key"]; } return $key; } // ################################################################### /** * Returns a value from the lex table for a specific code * * @access public * * @param string Lex code * * @return string Localized string */ function getlex($code) { if (defined('ISSO_LOCALIZE_DEBUG')) { return '&[@"' . $code . '"]'; } if (isset($this->lextable["$code"])) { return $this->lextable["$code"]; } trigger_error('Lex code `' . $code . '` did not appear in the lex table', E_USER_ERROR); } // ################################################################### /** * Sets a value in the lex table for easy access of strings * that are commonly used * * @access public * * @param string Lex code * @param string Text equiv */ function setlex($code, $value) { if (isset($this->lextable["$code"])) { trigger_error('Cannot set lex `' . $code . '` : value already exists', E_USER_ERROR); } $this->lextable["$code"] = $value; } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>