lithium\g11n\Message::aliases PHP Method

aliases() public static method

They can be embedded as content filters in the template layer using a filter for Media::_handle() or be used in other places where needed. Usage: $t('bike'); $tn('bike', 'bikes', 3); Using in a method: public function index() { extract(Message::aliases()); $notice = $t('look'); }
See also: lithium\net\http\Media::_handle()
public static aliases ( ) : array
return array Named aliases (`'t'` and `'tn'`) for translation functions.
    public static function aliases()
    {
        $t = function ($message, array $options = array()) {
            return Message::translate($message, $options + array('default' => $message));
        };
        $tn = function ($message1, $message2, $count, array $options = array()) {
            return Message::translate($message1, $options + compact('count') + array('default' => $count === 1 ? $message1 : $message2));
        };
        return compact('t', 'tn');
    }

Usage Example

Example #1
0
 /**
  * Renders view element
  * @return object
  */
 protected function renderView()
 {
     if (!isset($this->_view)) {
         $this->_view = new View(array('paths' => array('element' => '{:library}/views/elements/{:template}.{:type}.php'), 'outputFilters' => Message::aliases()));
     }
     return $this->_view;
 }
All Usage Examples Of lithium\g11n\Message::aliases