Pimcore\Placeholder\AbstractPlaceholder::setLocale PHP Method

setLocale() public method

Try to set the locale from different sources
public setLocale ( $locale = null )
$locale
    public function setLocale($locale = null)
    {
        if ($locale instanceof \Zend_Locale) {
            $this->locale = $locale;
        } elseif (is_string($locale)) {
            $this->locale = new \Zend_Locale($locale);
        } elseif ($this->getParam('locale') || $this->getParam('language')) {
            $this->setLocale($this->getParam('locale') ? $this->getParam('locale') : $this->getParam('language'));
        } else {
            $document = $this->getDocument();
            if ($document instanceof Document && $document->getProperty("language")) {
                $this->setLocale($document->getProperty("language"));
            }
            if (is_null($this->locale)) {
                //last chance -> get it from registry or use the first Language defined in the system settings
                if (\Zend_Registry::isRegistered("Zend_Locale")) {
                    $this->locale = \Zend_Registry::get("Zend_Locale");
                } else {
                    list($language) = \Pimcore\Tool::getValidLanguages();
                    $this->locale = new \Zend_Locale($language);
                }
            }
        }
        return $this;
    }