private static function instance() { $name = static::factory(); if (false === App::has($name)) { throw new Exception("You must define " . $name . " app before use it."); } return App::make($name); }
function trad($id, $default, $args = '') { $app = App::instance(); $lang = $app->getLang(); $translation = $lang->translate($id, $default); $args = eval('return array(' . $args . ');'); if (count($args)) { foreach ($args as $key => $value) { $translation = str_replace("%{$key}%", $value, $translation); } } return $translation; }