protected function getDomainLocale()
    {
        $state = FluentState::singleton();

        // Ensure a domain is configured
        if (!$state->getIsDomainMode()) {
            return null;
        }
        $domain = $state->getDomain();
        if (!$domain) {
            return null;
        }

        // Get domain
        $domainObj = Domain::getByDomain($domain);
        if (!$domainObj) {
            return null;
        }

        // If the current domain has exactly one locale, the locale is non-ambiguous
        $locales = Locale::getCached()->filter('DomainID', $domainObj->ID);
        /** @var Locale $localeObject */
        $localeObject = $locales->first();
        if ($localeObject) {
            return $localeObject->getLocale();
        }

        return null;
    }