protected function guessFrontendLocale($locales)
{
// search for match in array
if (is_array($locales)) {
foreach ($locales as $locale) {
$match = $this->matchLocaleInAvailableLanguages($locale);
if (strlen($match) > 0) {
return $match;
}
}
} else {
$match = $this->matchLocaleInAvailableLanguages($locales);
if (strlen($match) > 0) {
return $match;
}
}
return $this->defaultLocale;
}