/** * * Uses the chain locale object to get translations before falling back * to this object for locale. * * @param string $key The translation key, typically a validation method * name. * * @return string * */ protected function _chainLocale($key) { // the translated message; default to the translation key. $msg = $key; // if we have a locale object, get a message from it if ($this->_chain_locale_object) { // try to translate $msg = $this->_chain_locale_object->locale($key); // if the key failed to translate, fall back to the // translations from $this, but only if $this wasn't // the source to begin with. $failed = $msg === null || $msg == $key; if ($failed && $this != $this->_chain_locale_object) { $msg = $this->locale($key); } } // done return $msg; }