src/i18n/i18n.php
public static function with_locale($locale, $callback)
    {
        $oldLocale = self::$current_locale;
        static::set_locale($locale);
        try {
            return $callback();
        } finally {
            static::set_locale($oldLocale);
        }
    }
public static function with_locale($locale, $callback)
    {
        $oldLocale = self::$current_locale;
        static::set_locale($locale);
        try {
            return $callback();
        } finally {
            static::set_locale($oldLocale);
        }
    }
public static function with_locale ( $ locale , $ callback ) { $ oldLocale = self :: $ current_locale ; static :: set_locale ( $ locale ) ; try { return $ callback ( ) ; } finally { static :: set_locale ( $ oldLocale ) ; } }
Temporarily set the locale while invoking a callback

@param string $locale
@param callable $callback
@return mixed
Temporarily set the locale while invoking a callback