main/core/Controller/LocaleController.php
public function changeAction(Request $request, $locale)
    {
        if (($token = $this->tokenStorage->getToken()) && 'anon.' !== $token->getUser()) {
            $this->localeManager->setUserLocale($locale);
        }

        $request->setLocale($locale);
        $request->getSession()->set('_locale', $locale);

        return new RedirectResponse(
            $request->headers->get('referer')
        );
    }
public function changeAction(Request $request, $locale)
    {
        if (($token = $this->tokenStorage->getToken()) && 'anon.' !== $token->getUser()) {
            $this->localeManager->setUserLocale($locale);
        }

        $request->setLocale($locale);
        $request->getSession()->set('_locale', $locale);

        return new RedirectResponse(
            $request->headers->get('referer')
        );
    }
public function changeAction ( Request $ request , $ locale ) { if ( ( $ token = $ this -> tokenStorage -> getToken ( ) ) && 'anon.' !== $ token -> getUser ( ) ) { $ this -> localeManager -> setUserLocale ( $ locale ) ; } $ request -> setLocale ( $ locale ) ; $ request -> getSession ( ) -> set ( '_locale' , $ locale ) ; return new RedirectResponse ( $ request -> headers -> get ( 'referer' ) ) ; }
Change locale.

@EXT\Route("/change/{locale}", name="claroline_locale_change")

@param Request $request
@param string  $locale

@return RedirectResponse
Change locale .