messageSpec = $messageSpec; // Exception->getMessage() should be in plain English, not localized. // So fetch the English version of the message, without local // customizations, and make a basic attempt to turn markup into text. $msg = $this->getMessageObject()->inLanguage( 'en' )->useDatabase( false )->text(); $msg = preg_replace( '!!', '"', $msg ); $msg = Sanitizer::stripAllTags( $msg ); parent::__construct( $msg, $code, $previous ); } public function getMessageObject() { return Message::newFromSpecifier( $this->messageSpec ); } }