private static function trans($key, array $params = [], $domain = 'messages', $locale = null, $default = null)
    {
        $app = AppSingleton::get();

        // Handle default parameter
        if (isset($params['DEFAULT'])) {
            if ($default === null) {
                $default = $params['DEFAULT'];
            }
            unset($params['DEFAULT']);
        }

        // Handle number parameter
        if (isset($params['NUMBER'])) {
            $number = $params['NUMBER'];
            unset($params['NUMBER']);
        } else {
            $number = null;
        }

        // Translate
        try {
            if ($number === null) {
                $trans = $app['translator']->trans($key, $params, $domain, $locale);
            } else {
                $trans = $app['translator']->transChoice($key, $number, $params, $domain, $locale);
            }

            return ($trans === $key && $default !== null) ? $default : $trans;
        } catch (InvalidResourceException $e) {
            if (!isset($app['translationyamlerror']) && $app['request']->isXmlHttpRequest() === false) {
                $app['logger.flash']->danger('Error: You should fix this now, before continuing!<br>' . $e->getMessage());
                $app['translationyamlerror'] = true;
            }

            return strtr($key, $params);
        }
    }
private static function trans($key, array $params = [], $domain = 'messages', $locale = null, $default = null)
    {
        $app = AppSingleton::get();

        // Handle default parameter
        if (isset($params['DEFAULT'])) {
            if ($default === null) {
                $default = $params['DEFAULT'];
            }
            unset($params['DEFAULT']);
        }

        // Handle number parameter
        if (isset($params['NUMBER'])) {
            $number = $params['NUMBER'];
            unset($params['NUMBER']);
        } else {
            $number = null;
        }

        // Translate
        try {
            if ($number === null) {
                $trans = $app['translator']->trans($key, $params, $domain, $locale);
            } else {
                $trans = $app['translator']->transChoice($key, $number, $params, $domain, $locale);
            }

            return ($trans === $key && $default !== null) ? $default : $trans;
        } catch (InvalidResourceException $e) {
            if (!isset($app['translationyamlerror']) && $app['request']->isXmlHttpRequest() === false) {
                $app['logger.flash']->danger('Error: You should fix this now, before continuing!<br>' . $e->getMessage());
                $app['translationyamlerror'] = true;
            }

            return strtr($key, $params);
        }
    }
private static function trans ( $ key , array $ params = [ ] , $ domain = 'messages' , $ locale = null , $ default = null ) { $ app = AppSingleton :: get ( ) ; // Handle default parameter if ( isset ( $ params [ 'DEFAULT' ] ) ) { if ( $ default === null ) { $ default = $ params [ 'DEFAULT' ] ; } unset ( $ params [ 'DEFAULT' ] ) ; } // Handle number parameter if ( isset ( $ params [ 'NUMBER' ] ) ) { $ number = $ params [ 'NUMBER' ] ; unset ( $ params [ 'NUMBER' ] ) ; } else { $ number = null ; } // Translate try { if ( $ number === null ) { $ trans = $ app [ 'translator' ] -> trans ( $ key , $ params , $ domain , $ locale ) ; } else { $ trans = $ app [ 'translator' ] -> transChoice ( $ key , $ number , $ params , $ domain , $ locale ) ; } return ( $ trans === $ key && $ default !== null ) ? $ default : $ trans ; } catch ( InvalidResourceException $ e ) { if ( ! isset ( $ app [ 'translationyamlerror' ] ) && $ app [ 'request' ] -> isXmlHttpRequest ( ) === false ) { $ app [ 'logger.flash' ] -> danger ( 'Error: You should fix this now, before continuing!<br>' . $ e -> getMessage ( ) ) ; $ app [ 'translationyamlerror' ] = true ; } return strtr ( $ key , $ params ) ; } }
Low level translation.

@param string $key
@param array  $params
@param string $domain
@param mixed  $locale
@param mixed  $default

@return string
Low level translation .