/** * @param string $string * @param array|string $arguments * @param string $domain * @param string $locale * @return string * @author Rytis Grincevičius <*****@*****.**> */ public static function translate($string = '', array $arguments = array(), $domain = 'default', $locale = '') { $locale = $locale ?: static::_instance()->getLocale(); if (static::_instance()->_database) { $translation = Database::translate($string, $arguments, $domain, $locale); } else { $translation = 'file translations'; } if ($translation === false) { $translation = (static::$_instance->_debug ? '* ' : '') . $string; } return Translator::applyArguments($translation, $arguments); }
/** * @param array $arguments * @return $this * @author Rytis Grincevičius <*****@*****.**> */ public function args(array $arguments) { $translations = []; foreach ($this->translations as $key => $value) { $translations[$key] = Translator::applyArguments($value, $arguments); } $this->translations = $translations; return $this; }