/**
* For incoming traffic to the site root, determine if they should be redirected to any locale.
*
* @return string|null The locale to redirect to, or null
*/
protected function getRedirectLocale()
{
// Redirection interfere with flushing, so don't redirect
if (isset($_GET['flush'])) {
return null;
}
// Don't redirect if the user has clicked a link on the locale menu
if ($this->knownReferrer()) {
return null;
}
// Redirect if this user has previously viewed a page in any locale
if (Fluent::config()->remember_locale && ($locale = Fluent::get_persist_locale())) {
return $locale;
}
// Detect locale from browser Accept-Language header
if (Fluent::config()->detect_locale && ($locale = Fluent::detect_browser_locale())) {
return $locale;
}
}