PHP Class Contao\CoreBundle\EventListener\LocaleListener

Inheritance: use trait Contao\CoreBundle\Framework\ScopeAwareTrait
Datei anzeigen Open project: contao/core-bundle Class Usage Examples

Public Methods

Method Description
__construct ( array $availableLocales ) Constructor.
createWithLocales ( string $defaultLocale, string $rootDir ) : static Creates a new instance with the installed languages.
onKernelRequest ( GetResponseEvent $event ) Sets the default locale based on the request or session.

Private Methods

Method Description
formatLocaleId ( string $locale ) : string Formats a string to represent a locale ID.
getLocale ( Request $request ) : string Returns the locale from the request, the session or the HTTP header.

Method Details

__construct() public method

Constructor.
public __construct ( array $availableLocales )
$availableLocales array

createWithLocales() public static method

Creates a new instance with the installed languages.
public static createWithLocales ( string $defaultLocale, string $rootDir ) : static
$defaultLocale string
$rootDir string
return static

onKernelRequest() public method

Sets the default locale based on the request or session.
public onKernelRequest ( GetResponseEvent $event )
$event Symfony\Component\HttpKernel\Event\GetResponseEvent