/**
  * Get the locale, either from the parent or from the container if available
  * or the default locale if one is set.
  *
  * @param array $parameters the request parameters
  *
  * @return string
  */
 protected function getLocale($parameters)
 {
     $locale = parent::getLocale($parameters);
     if ($locale) {
         return $locale;
     }
     if (is_null($this->container) || !$this->container->isScopeActive('request') || !($request = $this->container->get('request'))) {
         return $this->defaultLocale;
     }
     return $request->getLocale();
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function supports($name)
 {
     return parent::supports($name) || $this->isSyliusClassInstance($name);
 }
 public function getLocale($parameters)
 {
     return parent::getLocale($parameters);
 }