/**
* Transform fr_FR to fr to fit the list of supported locales.
*
* @param $locale
*
* @return mixed
*/
protected function fixLocale($locale)
{
if (in_array($locale, $this->supportedLocales)) {
return $locale;
}
if (($short = Fixer::getLanguageFromLocale($locale)) !== $locale) {
if (in_array($short, $this->supportedLocales)) {
return $short;
}
}
// If no better locale found...
return $locale;
}