Converts a locale in POSIX format to eZ Publish internal format.
Returns null if conversion cannot be made.

@param string $posixLocale

@return string|null
333679
public function convertToEz($posixLocale)
    {
        if (!isset($this->reverseConversionMap[$posixLocale])) {
            $this->logger->warning("Could not convert locale '$posixLocale' to eZ Publish format. Please check your locale configuration in ezplatform.yml");

            return;
        }

        return $this->reverseConversionMap[$posixLocale];
    }
1232357
private function getLocaleCode($locale)
    {
        $locales = explode('_', strtolower($locale));
        $locale = array_pop($locales);

        if ('en' === $locale) {
            $locale = 'gb';
        }

        return $locale;
    }
502220
public static function getTimeFormat($locale = null)
    {
        $format = Zend_Locale_Data::getContent($locale, 'time');
        if (empty($format)) {

            throw new Zend_Locale_Exception("failed to receive data from locale $locale");
        }
        return $format;
    }
656068
public function isLocale($locale)
    {
        return stripos(i18n::convert_rfc1766($locale), i18n::convert_rfc1766($this->Locale)) === 0;
    }
1279939
public static function parseFromLocale($time, $locale, $tz = null)
    {
        return static::rawParse(static::translateTimeString($time, $locale, 'en'), $tz);
    }
881992
public function getTemplate($locale = null)
    {
        if (!$locale) {
            return $this->fallbackTemplate;
        }

        foreach ($this->i18nTemplates as $templateLocale => $template) {
            if (strtolower($templateLocale) === $locale) {
                return $template;
            }
        }

        return $this->fallbackTemplate;
    }
348157
public function getDeliveryCostFormatted($locale = null)
    {
        $formatter = $this->getFormatter($locale);

        return $formatter->format((float)$this->entity->getDeliveryCost());
    }
1353649
public static function getRegion($locale)
    {
        $parts = explode('-', str_replace('_', '-', $locale));

        if (count($parts) === 1) {
            return '';
        }

        $region = end($parts);

        if (strlen($region) === 4) {
            return '';
        }

        if ($region === 'POSIX') {
            $region = 'US';
        }

        return strtoupper($region);
    }
386315
public static final function configuration(string $locale) {
    if (!empty($locale)) {
      Lang::$locale = $locale;
    } else {
      Lang::$locale = Lang::STANDARD_LOCALE;
    }
    return null;
  }
328248
public function getI18n( $locale = null )
	{
		$locale = ( $locale !== null ? $locale : $this->getLocale()->getLanguageId() );

		if( !isset( $this->_i18n[$locale] ) ) {
			/// Locale ID %1$s
			throw new MShop_Exception( sprintf( 'Internationalization object not available for "%1$s"', $locale ) );
		}

		return $this->_i18n[$locale];
	}
476315
public static function setLocale($locale = null) {
        $app = app();
        $currentLocale = $app->config->get('app.locale');
        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 = $app->request->segment(1);
        }
        if (!in_array($locale, $app->config->get('sirgrimorum.crudgenerator.list_locales'))) {
            $locale = $currentLocale;
        }

        //if (!empty($this->supportedLocales[$locale])) {
        $currentLocale = $locale;
        //}

        $app->setLocale($currentLocale);

        return $currentLocale;
    }
597828
public function translateOrFirst($locale = null)
    {
        $translation = $this->translate($locale, true);

        if ( ! $translation)
        {
            $translation = $this->translations->first();
        }

        return $translation;
    }
1190523
public static function getLanguageFromLocale($locale)
    {
        if (strpos($locale, '_')) {
            $parts = explode('_', $locale);

            return strtolower($parts[0]);
        }

        return $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;
    }
791842
public function setLocale($locale = null)
    {
        if (is_null($locale)) {
            $locale = $this->getParent()->getLocale();
        }
        $this->locale = $locale;

        return $this;
    }
338915
public function forLocale($locale, $fallbacks=null)
    {
        $fork = $this->replicate()->setLocale($locale);

        if ($fallbacks) {
            return $fork->setFallbacks($fallbacks);
        }

        if ($this->localeFallbacks) {
            return $fork->setFallbacks($this->localeFallbacks);
        }

        return $fork;
    }
43054
private function inSupportedLocales(array $matches)
    {
        foreach (array_keys($matches) as $locale) {
            if ($this->isSupported($locale)) return $locale;

            // Search for acceptable locale by 'regional' => 'fr_FR' match.
            foreach ($this->supportedLocales as $key => $entity) {
                /** @var \Arcanedev\Localization\Entities\Locale $entity */
                if ($entity->regional() == $locale) return $key;
            }
        }

        return null;
    }