public function retrieveLocale(UserInterface $user = null, $requestLocale = null)
    {
        // Use request locale if defined.
        if ($requestLocale && is_string($requestLocale)) {
            return $requestLocale;
        }

        if ($user && $user->getLocale()) {
            return $user->getLocale();
        }

        return $this->fallbackLocale;
    }
public function retrieveLocale(UserInterface $user = null, $requestLocale = null)
    {
        // Use request locale if defined.
        if ($requestLocale && is_string($requestLocale)) {
            return $requestLocale;
        }

        if ($user && $user->getLocale()) {
            return $user->getLocale();
        }

        return $this->fallbackLocale;
    }
public function retrieveLocale ( UserInterface $ user = null , $ requestLocale = null ) { // Use request locale if defined. if ( $ requestLocale && is_string ( $ requestLocale ) ) { return $ requestLocale ; } if ( $ user && $ user -> getLocale ( ) ) { return $ user -> getLocale ( ) ; } return $ this -> fallbackLocale ; }
Function returns the locale that should be used by default.
If request-locale is set, then use this one.
Else return the locale of the user.

@param null|UserInterface $user
@param null|string $requestLocale

@return string
Function returns the locale that should be used by default . If request - locale is set then use this one . Else return the locale of the user .