protected function translate($message) { try { return Locale::t($message, $this->get_translation_replace_pairs()); } catch (\Exception $e) { return strtr($message, $this->get_translation_replace_pairs()); } }
public function validate() { if (isset($this->valid)) { return $this->valid; } if ($this->required && !isset($this->value)) { $this->errors[] = Locale::t('The field @name is required.', array('@name' => $this->label)); } return $this->valid = empty($this->errors); }