/** * Render source text * * @param [] $source * @param [] $arguments * @return string * @throws \Exception * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function render(array $source, array $arguments) { $text = end($source); try { $data = $this->translator->getData(); } catch (\Exception $e) { $this->logger->critical($e->getMessage()); throw $e; } return array_key_exists($text, $data) ? $data[$text] : $text; }
/** * Render source text * * @param [] $source * @param [] $arguments * @return string */ public function render(array $source, array $arguments) { $text = end($source); $code = $this->translator->getTheme() . '::' . $text; $data = $this->translator->getData(); if (array_key_exists($code, $data)) { return $data[$code]; } if (array_key_exists($text, $data)) { return $data[$text]; } return $text; }
/** * Render source text * * @param [] $source * @param [] $arguments * @return string * @throws \Exception * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function render(array $source, array $arguments) { $text = end($source); /* If phrase contains escaped quotes then use translation for phrase with non-escaped quote */ $text = str_replace('\\"', '"', $text); $text = str_replace("\\'", "'", $text); try { $data = $this->translator->getData(); } catch (\Exception $e) { $this->logger->critical($e->getMessage()); throw $e; } return array_key_exists($text, $data) ? $data[$text] : end($source); }
/** * Render source text * * @param [] $source * @param [] $arguments * @return string */ public function render(array $source, array $arguments) { $text = end($source); $data = $this->translator->getData(); return array_key_exists($text, $data) ? $data[$text] : $text; }