diff options
Diffstat (limited to 'src/helpers.php')
-rw-r--r-- | src/helpers.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/helpers.php b/src/helpers.php index 336f81fe..3a182bf7 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -3,6 +3,7 @@ use Engelsystem\Application; use Engelsystem\Config\Config; +use Engelsystem\Helpers\Translator; use Engelsystem\Http\Request; use Engelsystem\Http\Response; use Engelsystem\Http\UrlGenerator; @@ -119,6 +120,40 @@ function session($key = null, $default = null) } /** + * Translate the given message + * + * @param string $key + * @param array $replace + * @return string|Translator + */ +function trans($key = null, $replace = []) +{ + /** @var Translator $translator */ + $translator = app('translator'); + + if (is_null($key)) { + return $translator; + } + + return $translator->translate($key, $replace); +} + +/** + * Translate the given message + * + * @param string $key + * @param array $replace + * @return string + */ +function __($key, $replace = []) +{ + /** @var Translator $translator */ + $translator = app('translator'); + + return $translator->translate($key, $replace); +} + +/** * @param string $path * @param array $parameters * @return UrlGenerator|string |