Parses the request headers for a locale and updates $oLocale object

@param \Nails\Common\Factory\Locale $oLocale The locale object to update

@return $this
18817
public function sniffHeader(\Nails\Common\Factory\Locale &$oLocale)
    {
        $this->setFromString(
            $oLocale,
            $this->oInput->server('HTTP_ACCEPT_LANGUAGE') ?? ''
        );

        return $this;
    }
1111953
public function setLocale($locale = null)
    {
        if ($locale !== false) {
            // require_once 'Zend/Locale.php';
            $locale = Zend_Locale::findLocale($locale);
            if (strlen($locale) < 4) {
                // require_once 'Zend/Validate/Exception.php';
                throw new Zend_Validate_Exception('Region must be given for IBAN validation');
            }
        }

        $this->_locale = $locale;
        return $this;
    }
530166
public static function changeLocale($locale, $url = null) {
        $app = app();
        //$modeloClass = CrudGenerator::getModel($modelo, substr($modelo,0, strlen($modelo)-1));
        $base = "";
        $currentLocale = $app->getLocale();
        $defaultLocale = $app->config->get('app.locale');
        if ($locale === null) {
            $locale = $currentLocale;
        }
        if (!in_array($locale, $app->config->get('sirgrimorum.crudgenerator.list_locales'))) {
            $locale = $currentLocale;
        }
        if (empty($url)) {
            $url = $app->request->fullUrl();
            $urlLocale = $app->request->segment(1);
            if (in_array($urlLocale, $app->config->get('sirgrimorum.crudgenerator.list_locales'))) {
                $url = str_replace("/" . $urlLocale . "/", "/" . $locale . "/", $url);
            }
        } else {
            if (stripos($url, "/" . $currentLocale . "/") > 0) {
                $url = str_replace("/" . $currentLocale . "/", "/" . $locale . "/", $url);
            } elseif (substr($url, strlen($url) - (strlen($currentLocale) + 1)) == "/" . $currentLocale) {
                $url = substr($url, 0, strlen($url) - (strlen($currentLocale))) . $currentLocale;
            } elseif (stripos($url, "http://") === false && stripos($url, "https://") === false) {
                $url = str_replace("//", "/", $locale . "/" . $url);
            }
        }


        return $url;
    }
560723
public function locale(string $locale) : self
    {
        if ($this->validate and ! $locale) {
            throw new Exception("Open Graph: Invalid locale (none set)");
        }

        $this->forget('locale');

        $this->tags[] = $this->createTag('locale', $locale);

        return $this;
    }
1301682
public function BaseURLForLocale($locale)
    {
        $localeObject = Locale::getByLocale($locale);
        if (!$localeObject) {
            return null;
        }
        return $localeObject->getBaseURL();
    }
887394
public function setLocale($locale)
    {
        // Handle from locale + country
        switch (strtolower($locale)) {
            // “…”
            case 'pt-br':
                $this->opening = Fixer::LDQUO;
                $this->openingSuffix = '';
                $this->closing = Fixer::RDQUO;
                $this->closingPrefix = '';

                return;
        }

        // Handle from locale only
        $short = Fixer::getLanguageFromLocale($locale);

        switch ($short) {
            // « … »
            case 'fr':
                $this->opening = Fixer::LAQUO;
                $this->openingSuffix = Fixer::NO_BREAK_SPACE;
                $this->closing = Fixer::RAQUO;
                $this->closingPrefix = Fixer::NO_BREAK_SPACE;
                break;
            // «…»
            case 'hy':
            case 'az':
            case 'hz':
            case 'eu':
            case 'be':
            case 'ca':
            case 'el':
            case 'it':
            case 'no':
            case 'fa':
            case 'lv':
            case 'pt':
            case 'ru':
            case 'es':
            case 'uk':
                $this->opening = Fixer::LAQUO;
                $this->openingSuffix = '';
                $this->closing = Fixer::RAQUO;
                $this->closingPrefix = '';
                break;
            // „…“
            case 'de':
            case 'ka':
            case 'cs':
            case 'et':
            case 'is':
            case 'lt':
            case 'mk':
            case 'ro':
            case 'sk':
            case 'sl':
            case 'wen':
                $this->opening = Fixer::BDQUO;
                $this->openingSuffix = '';
                $this->closing = Fixer::LDQUO;
                $this->closingPrefix = '';
                break;
            // “…”
            case 'en':
            case 'us':
            case 'gb':
            case 'af':
            case 'ar':
            case 'eo':
            case 'id':
            case 'ga':
            case 'ko':
            case 'br':
            case 'th':
            case 'tr':
            case 'vi':
                $this->opening = Fixer::LDQUO;
                $this->openingSuffix = '';
                $this->closing = Fixer::RDQUO;
                $this->closingPrefix = '';
                break;
            // ”…”
            case 'fi':
            case 'sv':
            case 'bs':
                $this->opening = Fixer::RDQUO;
                $this->openingSuffix = '';
                $this->closing = Fixer::RDQUO;
                $this->closingPrefix = '';
                break;
        }
    }
591944
public function setLocale($locale)
    {
        if ($locale instanceof Locale) {
            $this->locale = $locale;
            return $this;
        }
        $this->locale = strtolower($locale);
        return $this;
    }
388471
public function setLocale($locale)
    {
        foreach ($this->datas as $data) {
            $data->getDefinition()->setLocale($locale);
        }
    }
144083
public function locale($locale = null)
    {
        // Set the locale if a valid local is passed
        if ($locale
            && ($locales = Config::get('decoy.site.locales'))
            && is_array($locales)
            && isset($locales[$locale])) {
            return Session::put('locale', $locale);
        }

        // Return the current locale or default to first one.  Store it in a local var
        // so that multiple calls don't have to do any complicated work.  We're assuming
        // the locale won't change within a single request.
        if (!$this->locale) {
            $this->locale = Session::get('locale', $this->defaultLocale());
        }

        return $this->locale;
    }
467334
public function setLocale($locale) {
		$this->locale          = trim($locale);
		$this->primaryLanguage = IntlLocale::getPrimaryLanguage($this->locale);
	}
1335587
public function getNewTranslation($locale)
    {
        $nodeSource = NodeSource::newWithType(
            $locale,
            $this->getNodeTypeName()
        );

        $this->translations->add($nodeSource);

        return $nodeSource;
    }
147297
public static function flagEmoji(\Nails\Common\Factory\Locale $oLocale): string
    {
        $sRegion    = $oLocale->getRegion();
        $aCountries = json_decode(
            file_get_contents(
                NAILS_APP_PATH . 'vendor/annexare/countries-list/dist/countries.emoji.json'
            )
        );

        return !empty($aCountries->{$sRegion}->emoji) ? $aCountries->{$sRegion}->emoji : '';
    }
1143011
public function setLocale(string $locale): self
    {
        assert(empty($locale) === false && locale_canonicalize($locale) === $locale);

        $this->locale = $locale;

        return $this;
    }
1193885
public function setLocale(string $locale): self
	{
		if ($locale === '') {
			$this->locale = $locale;
		} else {
			if (!\Locale::parseLocale($locale)) {
				throw new \InvalidArgumentException(sprintf('Invalid locale "%s"', $locale));
			}
			$this->locale = \Locale::canonicalize($locale);
		}

		$this->setOptions['locale'] = null;

		return $this;
	}
1073188
private function setLocale(string $locale)
    {
        $arr = \Locale::parseLocale($locale);
        
        if ($arr === false) {
            throw new \InvalidArgumentException('Invalid locale');
        }
        
        $this->locale = $arr;
    }
606050
public function setLocale($locale)
    {
        if($this->_locale != $locale)
        {
            parent::setLocale($locale);

            //Load the koowa translations
            $this->load('com:koowa');
        }

        return $this;
    }
1228312
protected function addLocaleToResource(Resource $oResource): void
    {
        /** @var Locale $oLocale */
        $oLocale = Factory::service('Locale');

        //  Add the locale for _this_ item
        $oResource->locale = $this->getLocale(
            $oResource->{static::$sColumnLanguage},
            $oResource->{static::$sColumnRegion}
        );

        //  Set the locales for all _available_ items
        $oResource->available_locales = array_map(function ($sLocale) use ($oLocale) {
            list($sLanguage, $sRegion) = $oLocale::parseLocaleString($sLocale);
            return $this->getLocale($sLanguage, $sRegion);
        }, explode(',', $oResource->available_locales));

        //  Specify which locales are missing
        $oResource->missing_locales = array_diff(
            $oLocale->getSupportedLocales(),
            $oResource->available_locales
        );

        //  Remove internal fields
        unset($oResource->{static::$sColumnLanguage});
        unset($oResource->{static::$sColumnRegion});
    }