public static function getTranslator($name = 'default', $locale = null)
    {
        $translators = static::translators();

        if ($locale) {
            $currentLocale = $translators->getLocale();
            $translators->setLocale($locale);
        }

        $translator = $translators->get($name);

        if (isset($currentLocale)) {
            $translators->setLocale($currentLocale);
        }

        return $translator;
    }
public static function getTranslator($name = 'default', $locale = null)
    {
        $translators = static::translators();

        if ($locale) {
            $currentLocale = $translators->getLocale();
            $translators->setLocale($locale);
        }

        $translator = $translators->get($name);

        if (isset($currentLocale)) {
            $translators->setLocale($currentLocale);
        }

        return $translator;
    }
public static function getTranslator ( $ name = 'default' , $ locale = null ) { $ translators = static :: translators ( ) ; if ( $ locale ) { $ currentLocale = $ translators -> getLocale ( ) ; $ translators -> setLocale ( $ locale ) ; } $ translator = $ translators -> get ( $ name ) ; if ( isset ( $ currentLocale ) ) { $ translators -> setLocale ( $ currentLocale ) ; } return $ translator ; }
Returns an instance of a translator that was configured for the name and locale.

If no locale is passed then it takes the value returned by the `getLocale()` method.

@param string $name The domain of the translation messages.
@param string|null $locale The locale for the translator.
@return \Aura\Intl\TranslatorInterface The configured translator.
@throws \Aura\Intl\Exception
Returns an instance of a translator that was configured for the name and locale .