src/Middleware/DetectLocaleMiddleware.php
protected function getDetectedLocale(HTTPRequest $request)
    {
        // Only detect on home page (landing page)
        if ($request->getURL() !== '') {
            return null;
        }
        // Respect config disable
        if (!FluentDirectorExtension::config()->get('detect_locale')) {
            return null;
        }

        /** @var LocaleDetector $detector */
        $detector = Injector::inst()->get(LocaleDetector::class);
        $localeObj = $detector->detectLocale($request);
        if ($localeObj) {
            return $localeObj->getLocale();
        }
        return null;
    }
protected function getDetectedLocale(HTTPRequest $request)
    {
        // Only detect on home page (landing page)
        if ($request->getURL() !== '') {
            return null;
        }
        // Respect config disable
        if (!FluentDirectorExtension::config()->get('detect_locale')) {
            return null;
        }

        /** @var LocaleDetector $detector */
        $detector = Injector::inst()->get(LocaleDetector::class);
        $localeObj = $detector->detectLocale($request);
        if ($localeObj) {
            return $localeObj->getLocale();
        }
        return null;
    }
protected function getDetectedLocale ( HTTPRequest $ request ) { // Only detect on home page (landing page) if ( $ request -> getURL ( ) !== '' ) { return null ; } // Respect config disable if ( ! FluentDirectorExtension :: config ( ) -> get ( 'detect_locale' ) ) { return null ; } /** @var LocaleDetector $detector */ $ detector = Injector :: inst ( ) -> get ( LocaleDetector :: class ) ; $ localeObj = $ detector -> detectLocale ( $ request ) ; if ( $ localeObj ) { return $ localeObj -> getLocale ( ) ; } return null ; }
Use the configured LocaleDetector to guess the locale

@param HTTPRequest $request
@return string
Use the configured LocaleDetector to guess the locale