public function usingLocale($locale, callable $callback, $fallbackLocale = null)
    {
        $originalLocale = $this->getLocale();
        $originalFallbackLocale = $this->getFallbackLocale();

        $this->setLocale($locale);
        $this->setFallbackLocale($fallbackLocale ?: $originalFallbackLocale);

        $result = $callback($this);

        $this->setFallbackLocale($originalFallbackLocale);
        $this->setLocale($originalLocale);

        return $result;
    }
public function usingLocale($locale, callable $callback, $fallbackLocale = null)
    {
        $originalLocale = $this->getLocale();
        $originalFallbackLocale = $this->getFallbackLocale();

        $this->setLocale($locale);
        $this->setFallbackLocale($fallbackLocale ?: $originalFallbackLocale);

        $result = $callback($this);

        $this->setFallbackLocale($originalFallbackLocale);
        $this->setLocale($originalLocale);

        return $result;
    }
public function usingLocale ( $ locale , callable $ callback , $ fallbackLocale = null ) { $ originalLocale = $ this -> getLocale ( ) ; $ originalFallbackLocale = $ this -> getFallbackLocale ( ) ; $ this -> setLocale ( $ locale ) ; $ this -> setFallbackLocale ( $ fallbackLocale ? : $ originalFallbackLocale ) ; $ result = $ callback ( $ this ) ; $ this -> setFallbackLocale ( $ originalFallbackLocale ) ; $ this -> setLocale ( $ originalLocale ) ; return $ result ; }
Run the given callable while using another locale.

@param string $locale
@param callable $callback
@param string|null $fallbackLocale
@return mixed
Run the given callable while using another locale .