public function message($key, array $vars = array()) {
        if (!$this->_messages) {
            $this->_loadMessages();
        }

        $locale = $this->getConfig('locale');

        if (empty($this->_messages[$locale])) {
            throw new MissingLocaleException(sprintf('Localized messages for %s do not exist', $locale));
        }

        $string = isset($this->_messages[$locale][$key]) ? $this->_messages[$locale][$key] : '';

        if ($string && $vars) {
            foreach ($vars as $key => $value) {
                $string = str_replace('{' . $key . '}', $value, $string);
            }
        }

        return $string;
    }
public function message($key, array $vars = array()) {
        if (!$this->_messages) {
            $this->_loadMessages();
        }

        $locale = $this->getConfig('locale');

        if (empty($this->_messages[$locale])) {
            throw new MissingLocaleException(sprintf('Localized messages for %s do not exist', $locale));
        }

        $string = isset($this->_messages[$locale][$key]) ? $this->_messages[$locale][$key] : '';

        if ($string && $vars) {
            foreach ($vars as $key => $value) {
                $string = str_replace('{' . $key . '}', $value, $string);
            }
        }

        return $string;
    }
public function message ( $ key , array $ vars = array ( ) ) { if ( ! $ this -> _messages ) { $ this -> _loadMessages ( ) ; } $ locale = $ this -> getConfig ( 'locale' ) ; if ( empty ( $ this -> _messages [ $ locale ] ) ) { throw new MissingLocaleException ( sprintf ( 'Localized messages for %s do not exist' , $ locale ) ) ; } $ string = isset ( $ this -> _messages [ $ locale ] [ $ key ] ) ? $ this -> _messages [ $ locale ] [ $ key ] : '' ; if ( $ string && $ vars ) { foreach ( $ vars as $ key => $ value ) { $ string = str_replace ( '{' . $ key . '}' , $ value , $ string ) ; } } return $ string ; }
Return a message string if it exists.

@param string $key
@param array $vars
@return string
@throws \Decoda\Exception\MissingLocaleException
Return a message string if it exists .