Neos\Flow\I18n\Detector::detectLocaleFromTemplateLocale PHP Method

detectLocaleFromTemplateLocale() public method

Returns best-matching Locale object based on the template Locale object provided as parameter. System default locale will be returned if no successful matches were done.
public detectLocaleFromTemplateLocale ( Locale $locale ) : Locale
$locale Locale The template Locale object
return Locale Best-matching existing Locale instance
    public function detectLocaleFromTemplateLocale(Locale $locale)
    {
        $bestMatchingLocale = $this->localeCollection->findBestMatchingLocale($locale);
        if ($bestMatchingLocale !== null) {
            return $bestMatchingLocale;
        }
        return $this->localizationService->getConfiguration()->getDefaultLocale();
    }