public function index() { //Doctrine::createTablesFromArray(array('Rosetta')); $r = RosettaManager::instance(); $this->view->output = $r->setTo('ru')->translate('Bluebox now supports Freeswitch!'); $this->view->moreoutput = $r->translate('Now with more features!'); }
public static function instance() { if (!isset(self::$instance)) { $c = __CLASS__; self::$instance = new $c(); } return self::$instance; }
/** * This function translates a given string and returns the * translation if successfull or the original string */ public function translate($message = NULL) { //preform translation $session = Session::instance(); $lang = $session->get('lang', 'en'); if (!empty($message) && $lang != 'en') { if (class_exists('RosettaManager')) { try { $r = RosettaManager::instance(); $msg = $r->setTo($lang)->translate($message); if (!empty($msg)) { return $msg; } } catch (exception $e) { } } } return $message; }