/** * Return a Translation2 instance already initialized * * @param string $driver Type of the storage driver * @param mixed $options Additional options for the storage driver * (example: if you are using DB as the storage * driver, you have to pass the dsn string here) * @param array $params Array of parameters for the adapter class * (i.e. you can set here the mappings between your * table/field names and the ones used by this class) * * @return object Translation2 instance or PEAR_Error on failure * @static */ static function &factory($driver, $options = '', $params = array()) { $tr = new Translation2(); $tr->storage = Translation2::_storageFactory($driver, $options); if (PEAR::isError($tr->storage)) { return $tr->storage; } $tr->_setDefaultOptions(); $tr->_parseOptions($params); $tr->storage->_parseOptions($params); return $tr; }