Example #1
0
 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!');
 }
Example #2
0
 public static function instance()
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
Example #3
0
File: i18n.php Project: swk/bluebox
 /**
  * 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;
 }