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

@param string $ezpLocale

@return string|null
978699
public function convertToPOSIX($ezpLocale)
    {
        if (!isset($this->conversionMap[$ezpLocale])) {
            $this->logger->warning("Could not convert locale '$ezpLocale' to POSIX format. Please check your locale configuration in ezplatform.yml");

            return;
        }

        return $this->conversionMap[$ezpLocale];
    }
566821
static function getLangByUrl($url = null)
    {
        if ($url === null) {
            return null;
        } else {
            $language = Lang::find()->where('url = :url', [':url' => $url])->one();
            if ( $language === null ) {
                return null;
            }else{
                return $language;
            }
        }
    }
493947
static function create( $localeString = false )
    {
        if ( $localeString === false )
        {
            $ini = eZINI::instance();
            $localeString = $ini->variable( 'RegionalSettings', 'Locale' );
        }
        return new eZLocale( $localeString );
    }
927597
public function getCountryName($inLocale = null)
    {
        $inLocale = Locale::sanitizeLocale($inLocale, $this->locale);

        return \Locale::getDisplayRegion($this->locale, $inLocale);
    }
891260
static function generateNodeView( $tpl, $node, $object, $languageCode, $viewMode, $offset,
                                      $cacheDir, $cachePath, $viewCacheEnabled,
                                      $viewParameters = array( 'offset' => 0, 'year' => false, 'month' => false, 'day' => false ),
                                      $collectionAttributes = false, $validation = false )
    {
        $cacheFile = eZClusterFileHandler::instance( $cachePath );
        $args = compact( "tpl", "node", "object", "languageCode", "viewMode", "offset",
                         "viewCacheEnabled",
                         "viewParameters",
                         "collectionAttributes", "validation" );
        $Result = $cacheFile->processCache( null, // no retrieve, only generate is called
                                            array( 'eZNodeviewfunctions', 'generateCallback' ),
                                            null,
                                            null,
                                            $args );
        return $Result;
    }
836305
public static function ezpI18ntr( $context, $message, $comment = null, $argument = null )
    {
        // eZ Publish < 4.3 => use old i18n system
        if( eZPublishSDK::majorVersion() == 4 && eZPublishSDK::minorVersion() < 3 )
        {
            include_once( 'kernel/common/i18n.php' );
            return ezi18n( $context, $message, $comment, $argument );
        }
        else
        {
            return ezpI18n::tr( $context, $message, $comment, $argument );
        }
    }
1367371
public function forLocale($locale, $fallbacks = null)
    {
        $fork = new static(
            $this->coreFormatter,
            $this->extractor,
            $this->typeProvider,
            $this->textProvider,
            $this->_extensions
        );

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

        return $fork->setLocale($locale);
    }
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;
    }
1318218
private function createCalendar(string $locale = null) : \IntlCalendar
    {
        $timezone = \IntlTimeZone::createTimeZone($this->date()->getTimezone()->getName());
        $calendar = \IntlCalendar::createInstance($timezone, $locale);
        
        $calendar->setTime($this->timestampWithMillisecond());
        
        return $calendar;
    }
690270
protected function checkLocale($locale)
    {
        $languageFound = null;
        $language = strstr($locale, '_', true);

        foreach ($this->configuration['locales'] as $availableLocale) {
            // If locale matches, the exact matching was found.
            if ($availableLocale === $locale) {
                return $availableLocale;
            }

            // Check if language (without locale) matches.
            if ($language == $availableLocale) {
                $languageFound = $availableLocale;
            }
        }

        if ($languageFound) {
            return $languageFound;
        }

        return null;
    }
501215
public static function getDateFormat($locale = null)
    {
        $format = Zend_Locale_Data::getContent($locale, 'date');
        if (empty($format)) {

            throw new Zend_Locale_Exception("failed to receive data from locale $locale");
        }

        return $format;
    }
533329
public function getTranslationByLocale($locale)
    {
        foreach ($this->getTranslations() as $valueTranslation) {
            if ($valueTranslation->getLocale() === $locale) {
                return $valueTranslation;
            }
        }

        return null;
    }
1362500
function ezText( $text, $size=0, $options=array(), $test=0)
    {
        $text = eZPDFTable::fixWhitespace( $text );

        $textLen = strlen( $text );
        $newText = '';
        for ( $offSet = 0; $offSet < $textLen; $offSet++ )
        {
            if ( $text[$offSet] == '<' )
            {
                if ( strcmp( substr($text, $offSet+1, strlen( 'ezCall' ) ), 'ezCall' ) == 0 ) // ez library preprocessing call.
                {
                    $newTextLength = strlen( $newText );
                    if ( $newTextLength > 0 && $newText[$newTextLength - 1] == "\n" )
                    {
                        $newText = rtrim( $newText, "\n" );
                        $this->addDocSpecification( $newText );
                        $newText = "\n";
                    }
                    else
                    {
                        $this->addDocSpecification( $newText );
                        $newText = '';
                    }

                    $params = array();
                    $funcName = '';

                    $offSet = eZPDFTable::extractFunction( $text, $offSet, $funcName, $params, 'ezCall' );

                    $newText .= $this->$funcName( $params );

                    continue;
                }
                else if ( strcmp( substr($text, $offSet+1, strlen( '/ezCall' ) ), '/ezCall' ) == 0 )
                {
                    $this->addDocSpecification( $newText );
                    array_pop( $this->PreStack );
                    $offSet = strpos( $text, '>', $offSet );
                    $newText = '';
                    continue;
                }
                else if ( strcmp( substr($text, $offSet+1, strlen( 'ezGroup' ) ), 'ezGroup' ) == 0 ) // special call for processing whole text group, used by extends table.
                {
                    $newTextLength = strlen( $newText );
                    if ( $newTextLength > 0 && $newText[$newTextLength - 1] == "\n" )
                    {
                        $newText = rtrim( $newText, "\n" );
                        $this->addDocSpecification( $newText );
                        $newText = "\n";
                    }
                    else
                    {
                        $this->addDocSpecification( $newText );
                        $newText = '';
                    }

                    $params = array();
                    $funcName = '';

                    $offSet = eZPDFTable::extractFunction( $text, $offSet, $funcName, $params, 'ezGroup' );
                    $offSet++;
                    $endGroup = strpos( $text, '</ezGroup:', $offSet );
                    $groupText = substr( $text, $offSet, $endGroup - $offSet );
                    $groupText = urldecode( $groupText );

                    $this->$funcName( $params, $groupText );

                    $offSet = strpos( $text, '>', $endGroup );
                    continue;
                }
            }
            $newText .= $text[$offSet];
        }
        if ( strlen( $newText ) > 0 )
        {
            $this->addDocSpecification( $newText );
        }

        $this->outputDocSpecification();
    }
1143713
protected function parse($locale, $returnType = null)
    {
        if (extension_loaded('intl')) {
            $info = \Locale::parseLocale($locale);
        } else {
            $info = array();

            if (!preg_match('~^(?<language>[a-z]{2,4})([_-](?<region>[a-z]{2,4}))?$~i', $locale, $info)) {
                return null;
            }

            if (isset($info['region'])) {
                $info['region'] = strtoupper($info['region']);
            }
        }

        if ($returnType !== null) {
            $value = ($info && isset($info[$returnType]))? $info[$returnType] : null;
            return $value;
        }

        return $info;
    }
983202
protected void setLocale(String strLocale) {
	if (strLocale == null) {
	    this.locale = Locale.US;
	}
	else {
	    try {
		this.locale = Caster.toLocale(strLocale);
		if (this.locale == null) this.locale = Locale.US;
	    }
	    catch (ExpressionException e) {
		this.locale = Locale.US;
	    }
	}
    }
235940
public function getUrlSegment(\Nails\Common\Factory\Locale $oLocale): string
    {
        if ($oLocale == $this->getDefautLocale()) {
            return '';
        } else {
            return getFromArray((string) $oLocale, static::URL_VANITY_MAP, (string) $oLocale);
        }
    }
463509
public function setLocale($locale = null)
    {
        if (class_exists('\Locale')) {
            $this->locale = \Locale::lookup(
                $this->getAvailableLocales(),
                $locale,
                true,
                $this->getSettings()->locale->default
            );
        }

        if (empty($this->locale)) {
            $this->locale = $this->getSettings()->locale->default;
        }

        // Set up locale environment for gettext.
        bindtextdomain(self::TEXT_DOMAIN_NAME, self::TEXT_DOMAIN_LOCATION);
        bind_textdomain_codeset(self::TEXT_DOMAIN_NAME, 'UTF-8');
        textdomain(self::TEXT_DOMAIN_NAME);
        putenv('LANG=' . $this->locale);
        putenv('LC_MESSAGES=' . $this->locale);
        $locale = setlocale(LC_MESSAGES, $this->locale);

        Logger::get()->info(sprintf('Locale is now %s [%s] (domain "%s" at %s)',
            $locale,
            $this->locale,
            self::TEXT_DOMAIN_NAME,
            realpath(self::TEXT_DOMAIN_LOCATION)
        ));
    }