protected function translateMessage($category, $message, $language)
    {
        $key = $language . '/' . $category;
        if (!isset($this->_messages[$key])) {
            $this->_messages[$key] = $this->loadMessages($category, $language);
        }
        if (isset($this->_messages[$key][$message]) && $this->_messages[$key][$message] !== '') {
            return $this->_messages[$key][$message];
        } elseif ($this->hasEventHandlers(self::EVENT_MISSING_TRANSLATION)) {
            $event = new MissingTranslationEvent([
                'category' => $category,
                'message' => $message,
                'language' => $language,
            ]);
            $this->trigger(self::EVENT_MISSING_TRANSLATION, $event);
            if ($event->translatedMessage !== null) {
                return $this->_messages[$key][$message] = $event->translatedMessage;
            }
        }

        return $this->_messages[$key][$message] = false;
    }
protected function translateMessage($category, $message, $language)
    {
        $key = $language . '/' . $category;
        if (!isset($this->_messages[$key])) {
            $this->_messages[$key] = $this->loadMessages($category, $language);
        }
        if (isset($this->_messages[$key][$message]) && $this->_messages[$key][$message] !== '') {
            return $this->_messages[$key][$message];
        } elseif ($this->hasEventHandlers(self::EVENT_MISSING_TRANSLATION)) {
            $event = new MissingTranslationEvent([
                'category' => $category,
                'message' => $message,
                'language' => $language,
            ]);
            $this->trigger(self::EVENT_MISSING_TRANSLATION, $event);
            if ($event->translatedMessage !== null) {
                return $this->_messages[$key][$message] = $event->translatedMessage;
            }
        }

        return $this->_messages[$key][$message] = false;
    }
protected function translateMessage ( $ category , $ message , $ language ) { $ key = $ language . '/' . $ category ; if ( ! isset ( $ this -> _messages [ $ key ] ) ) { $ this -> _messages [ $ key ] = $ this -> loadMessages ( $ category , $ language ) ; } if ( isset ( $ this -> _messages [ $ key ] [ $ message ] ) && $ this -> _messages [ $ key ] [ $ message ] !== '' ) { return $ this -> _messages [ $ key ] [ $ message ] ; } elseif ( $ this -> hasEventHandlers ( self :: EVENT_MISSING_TRANSLATION ) ) { $ event = new MissingTranslationEvent ( [ 'category' => $ category , 'message' => $ message , 'language' => $ language , ] ) ; $ this -> trigger ( self :: EVENT_MISSING_TRANSLATION , $ event ) ; if ( $ event -> translatedMessage !== null ) { return $ this -> _messages [ $ key ] [ $ message ] = $ event -> translatedMessage ; } } return $ this -> _messages [ $ key ] [ $ message ] = false ; }
Translates the specified message.
If the message is not found, a [[EVENT_MISSING_TRANSLATION|missingTranslation]] event will be triggered.
If there is an event handler, it may provide a [[MissingTranslationEvent::$translatedMessage|fallback translation]].
If no fallback translation is provided this method will return `false`.
@param string $category the category that the message belongs to.
@param string $message the message to be translated.
@param string $language the target language.
@return string|bool the translated message or false if translation wasn't found.
Translates the specified message . If the message is not found a [[ EVENT_MISSING_TRANSLATION|missingTranslation ]] event will be triggered . If there is an event handler it may provide a [[ MissingTranslationEvent :: $translatedMessage|fallback translation ]] . If no fallback translation is provided this method will return false .