/** * Translate a sentence * * @param string $sentence * @param array $placeholders (optional) * @param string|null $lang (optional) * * @return string */ public function translate($sentence, $placeholders = array(), $lang = null) { if ($lang === null) { $lang = $this->language; } if (!isset($this->translations[$lang])) { $this->translations[$lang] = $this->app->translations()->read($lang, array()); } $translation =& $this->translations[$lang]; if (isset($translation[$sentence])) { $sentence = $translation[$sentence]; } return $this->placeholder->replace($sentence, $placeholders); }