From 678bb948e73f38e10e9e23269edc485ed1658aa2 Mon Sep 17 00:00:00 2001 From: Lito Date: Sat, 18 Feb 2017 18:21:36 +0100 Subject: [PATCH] Updated README.md --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2a97492..60ee493 100644 --- a/README.md +++ b/README.md @@ -87,10 +87,15 @@ namespace App\Providers { } namespace { - // Change "txt" with your custom gettext function name function txt($original) { - $text = app('gettext')->getTranslator()->gettext($original); + static $translator; + + if (empty($translator)) { + $translator = app('gettext')->getTranslator(); + } + + $text = $translator->gettext($original); if (func_num_args() === 1) { return $text; @@ -101,7 +106,6 @@ namespace { return is_array($args[0]) ? strtr($text, $args[0]) : vsprintf($text, $args); } } - ``` # Configuration