/** * {@inheritdoc} */ public function load($resource, $locale, $domain = 'messages') { if (!stream_is_local($resource)) { throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); } if (!file_exists($resource)) { throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); } $messages = array_filter(require $resource); return parent::load($messages, $locale, $domain); }
/** * {@inheritdoc} */ public function load($resource, $locale, $domain = 'messages') { if (!stream_is_local($resource)) { throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); } if (!file_exists($resource)) { throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); } $messages = $this->parse($resource); // empty file if (null === $messages) { $messages = []; } // not an array if (!is_array($messages)) { throw new InvalidResourceException(sprintf('The file "%s" must contain a valid mo file.', $resource)); } return parent::load($messages, $locale, $domain); }