You are here

public function CurrentLocale::getLocale in Commerce Core 8.2

Gets the locale for the current request.

Return value

\Drupal\commerce\Locale The locale.

Overrides CurrentLocaleInterface::getLocale

File

src/CurrentLocale.php, line 59

Class

CurrentLocale
Holds a reference to the current locale, resolved on demand.

Namespace

Drupal\commerce

Code

public function getLocale() {
  $request = $this->requestStack
    ->getCurrentRequest();
  if (!$this->locales
    ->contains($request)) {
    $this->locales[$request] = $this->chainResolver
      ->resolve();
  }
  return $this->locales[$request];
}