Get locale.

@param bool $realLocale [optional] Get mapped value (if exists)

@return string
968596
public function getLocale($realLocale = false)
    {
        $active = $this->getActive();

        if (!$active) {
            return null;
        }

        if ($realLocale) {
            return $this->getMap($active, 'locale') ?: $active->getLocale();
        }

        return $active->getLocale();
    }
987760
private function getTranslation($withDefault = false)
    {
        $translation = $this->getTranslationByLocale($this->locale);

        if (true === $withDefault && null === $translation && null !== $this->getDefaultLocale()) {
            return $this->getTranslationByLocale($this->getDefaultLocale());
        }

        return $translation;
    }
488555
public function getClosureByLocale($locale)
    {
        return $queryBuilder = function (EntityRepository $er) use ($locale) {
            $queryBuilder = $er->createQueryBuilder('p');
            $queryBuilder->andWhere('p.locale = :locale');
            $queryBuilder->setParameter('locale', $locale);

            return $queryBuilder;
        };
    }
165554
public function get($key, $locale = null)
    {
        if(!$locale){
            $locale = $this->getLocale();
        }

        if($locale == config('translator.default')){
            return $key;
        }

        $this->load($locale);

        if (!isset($this->languages[$locale][$key])){
            $this->setMissing($key, $locale);
            return $key;
        }

        return $this->languages[$locale][$key]["value"];
    }
633805
public function translate($locale) {
		$localeEntity = clone $this;
		$localeEntity->setLocale($locale);
		if(isset($this->data['translations'][$locale]))
			$localeEntity->_set($this->data['translations'][$locale]);
		unset($localeEntity->data['translations'][$locale]);
		$localeEntity->data['translations'][$this->getLocale()] = $this->data['properties'];

		return $localeEntity;
	}
1229865
public function getKeyword( $locale = false )
    {
        if ( $this->attribute( 'id' ) == null )
            return $this->Keyword;

        $translation = $this->translationByLocale( $locale === false ? $this->CurrentLanguage : $locale );
        if ( $translation instanceof eZTagsKeyword )
            return $translation->attribute( 'keyword' );

        return '';
    }
245809
public function resolveDomainForLocale($locale)
    {
        foreach ($this->localeDomainConfig as $domain => $domainLocale) {
            if ($locale === $domainLocale) {
                return $domain;
            }
        }

        return $this->defaultLocale;
    }
451717
public function getLocale()
	{
		if (!isset($this->locale))
		{
			$locale = str_replace(' ', '', isset($this->metadata['locale']) ? $this->metadata['locale'] : '');

			if ($locale)
			{
				$this->locale = explode(',', $locale);
			}
			else
			{
				$this->locale = false;
			}
		}

		return $this->locale;
	}
626204
public function getReference($locale = null)
    {
        $locale = $locale ?: $this->getCurrentLocale();
        if (is_array($this->references) && isset($this->references[$locale])) {
            return $this->references[$locale];
        }
    }
60018
public function setLocale($locale = null)
    {
        if (empty($locale) || ! is_string($locale)) {
            // If the locale has not been passed through the function
            // it tries to get it from the first segment of the url
            $locale = $this->request()->segment(1);
        }

        if ($this->isSupportedLocale($locale)) {
            $this->setCurrentLocale($locale);
        }
        else {
            // if the first segment/locale passed is not valid the system would ask which locale have to take
            // it could be taken by the browser depending on your configuration
            $locale = null;

            $this->getCurrentOrDefaultLocale();
        }

        $this->app->setLocale($this->getCurrentLocale());
        $this->updateRegional();

        return $locale;
    }
826476
protected function getLocale($locale)
    {
        $result = null;
        if ($locale instanceof LocaleEntity) {
            $result = $locale;
        } elseif (is_string($locale) && $locale !== '') {
            $result = $this->app->make(LocaleRepository::class)->findApproved($locale);
        }

        return $result;
    }
1069185
private function getFallbackLocale($locale = null)
    {
        if ($locale && $this->isLocaleCountryBased($locale)) {
            if ($fallback = $this->getLanguageFromCountryBasedLocale($locale)) {
                return $fallback;
            }
        }

        return config('translatable.fallback_locale');
    }
1157733
protected function findTranslationByLocale($locale, $withNewTranslations = true)
    {
        $translation = $this->getTranslations()->get($locale);

        if ($translation) {
            return $translation;
        }

        if ($withNewTranslations) {
            return $this->getNewTranslations()->get($locale);
        }
    }
797950
public function getLocalization($locale)
    {
        $dataCollection = $this->getLocalizations();
        $data = $dataCollection->get($locale);

        return $data;
    }
283264
public function getDefaultResourceForLocale( $locale )
    {
        $resource = null;

        if( $this->getValue() && !$this->getValue()->isEmpty() )
        {
            foreach( $this->getValue() as $index => $item )
            {
                if( $item->{$this->getModel()->getLocaleKey()} === $locale )
                {
                    $resource = $item;
                }
            }
        }

        return $resource;
    }
1372378
protected function getLocalizedRedirect($locale)
    {
        return is_string($localizedUrl = $this->localization->getLocalizedURL($locale))
            ? $this->makeRedirectResponse($localizedUrl)
            : null;
    }
177078
public function getRouteLocalePrefix($locale = null) {
        if (is_null($locale)) {
            $locale = $this->getLocaleFromRoute();
        }
        return $this->getDefaultRoutelocale() === $locale ? ($this->isUsePrefixForDefaultLocale() ? $locale : '') : $locale;
    }