Returns a standard greeting for the current user.

@param string $locale
@return int
171537
public function getGreeting($locale = null)
    {
        if (! $this->_getVar('user_greeting')) {
            $greeting[] = $this->getGenderGreeting($locale);

            if ($this->_getVar('user_last_name')) {
                $greeting[] = $this->_getVar('user_surname_prefix');
                $greeting[] = $this->_getVar('user_last_name');
            } else {
                $name = $this->getLoginName();
                if ($name) {
                    $name = substr($name, 0, 3) . str_repeat('*', strlen($name) - 2);
                    $greeting[] = $name;
                }
            }
            array_filter($greeting);

            $this->_setVar('user_greeting', implode(' ', $greeting));
        }

        return $this->_getVar('user_greeting');
    }
797950
public function getLocalization($locale)
    {
        $dataCollection = $this->getLocalizations();
        $data = $dataCollection->get($locale);

        return $data;
    }
1344509
public function LocaleInformation($locale = null)
    {
        // Check locale and get object
        if ($locale) {
            $localeObj = Locale::getByLocale($locale);
        } else {
            $localeObj = Locale::getDefault();
        }
        $locale = $localeObj->getLocale();

        // Check linking mode
        $linkingMode = $this->getLinkingMode($locale);

        // Check link
        $link = $this->LocaleLink($locale);

        // Store basic locale information
        return ArrayData::create([
            'Locale' => $locale,
            'LocaleRFC1766' => i18n::convert_rfc1766($locale),
            'URLSegment' => $localeObj->getURLSegment(),
            'Title' => $localeObj->getTitle(),
            'LanguageNative' => $localeObj->getNativeName(),
            'Language' => i18n::getData()->langFromLocale($locale),
            'Link' => $link,
            'AbsoluteLink' => $link ? Director::absoluteURL($link) : null,
            'LinkingMode' => $linkingMode
        ]);
    }
206936
private static function _checkLocale($locale)
    {
        if (empty($locale)) {
            $locale = new Zend_Locale();
        }

        if (!(Zend_Locale::isLocale((string) $locale, null, false))) {

            throw new Zend_Locale_Exception("Locale (" . (string) $locale . ") is a unknown locale");
        }

        return (string) $locale;
    }
861475
public static function current($locale = null)
    {
        // Сохраним старое значение локали
        $_locale = self::$current_locale;

        // If nothing is passed just return current locale
        if (!isset($locale)) {
            return $_locale;

        } else { // Switch locale
            // Save new locale
            self::$current_locale = strtolower($locale);

            // Запишем текущее значение локализации
            $_SESSION['__SAMSON_LOCALE__'] = self::$current_locale;

            // Вернем текущее значение локали сайта до момента візова метода
            return self::$current_locale;
        }
    }
729915
private function getFormatter($locale = 'de-AT')
    {
        $formatter = new \NumberFormatter($locale, \NumberFormatter::DECIMAL);
        $formatter->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, 2);
        $formatter->setAttribute(\NumberFormatter::DECIMAL_ALWAYS_SHOWN, 1);

        return $formatter;
    }
800855
static function idByLocale( $locale )
    {
        $language = eZContentLanguage::fetchByLocale( $locale );
        if ( $language )
        {
            return (int)$language->attribute( 'id' );
        }
        else
        {
            return false;
        }
    }
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;
    }
705328
public function uri($locale = null)
    {
        $locale = $locale ?: config('app.locale');
        $uri = $this->translate('uri', $locale);
        if (
            config('app.fallback_locale') != $locale ||
            config('typicms.main_locale_in_url')
        ) {
            $uri = $uri ? $locale.'/'.$uri : $locale;
        }

        return $uri ?: '/';
    }
809401
protected function fixLocale($locale)
    {
        if (in_array($locale, $this->supportedLocales)) {
            return $locale;
        }

        if (($short = Fixer::getLanguageFromLocale($locale)) !== $locale) {
            if (in_array($short, $this->supportedLocales)) {
                return $short;
            }
        }

        // If no better locale found...
        return $locale;
    }
164910
public function getLinkingMode($locale)
    {
        if ($this->owner->hasMethod('canViewInLocale') && !$this->owner->canViewInLocale($locale)) {
            return 'invalid';
        }

        if ($locale === FluentState::singleton()->getLocale()) {
            return 'current';
        }

        return 'link';
    }
955557
public static function localeHasDiffOneDayWords($locale)
    {
        return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) {
            return $newLocale &&
                $translator->trans('diff_now') !== 'diff_now' &&
                $translator->trans('diff_yesterday') !== 'diff_yesterday' &&
                $translator->trans('diff_tomorrow') !== 'diff_tomorrow';
        });
    }
783734
protected function getLocalise($locale = 'en-GB')
    {
        $locale = LanguageNormalize::toLanguageTag($locale);

        if (empty($this->localises[$locale]) || !($this->localises[$locale] instanceof LocaliseInterface)) {
            $tag = LanguageNormalize::getLocaliseClassPrefix($this->locale);

            $class = sprintf('Windwalker\\Language\\Localise\\%sLocalise', $tag);

            if (!class_exists($class)) {
                $class = 'Windwalker\\Language\\Localise\\NullLocalise';
            }

            $this->localises[$locale] = new $class();
        }

        return $this->localises[$locale];
    }
970007
private function processLocale(LocaleEntity $locale)
    {
        $result = 0;
        $this->logger->info(sprintf('Processing %s (%s)', $locale->getName(), $locale->getID()));
        $aspiringGroup = $this->groupsHelper->getAspiringTranslators($locale);
        $aspiringGroupMemberIDs = $aspiringGroup->getGroupMemberIDs();
        $numberOfAspiringMembers = count($aspiringGroupMemberIDs);
        if ($numberOfAspiringMembers === 0) {
            $this->logger->info('  - No pending requests found.');
        } else {
            foreach ($aspiringGroupMemberIDs as $memberID) {
                if ($this->processAspiring($locale, $aspiringGroup, $memberID)) {
                    ++$result;
                }
            }
            $this->logger->info(sprintf('  - %d out of %d requests accepted.', $result, $numberOfAspiringMembers));
        }

        return $result;
    }
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;
    }
1028500
protected function getStatus($locale)
    {
        /** @var Status[] $statuses */
        $statuses = $this->get('sulu_product.status_manager')->findAll($locale);

        $statusTitles = [];
        foreach ($statuses as $status) {
            $statusTitles[] = [
                'id' => $status->getId(),
                'name' => $status->getName(),
            ];
        }

        return $statusTitles;
    }