public function CurrentLocale::getLocale in Price 8
Same name and namespace in other branches
- 3.x src/CurrentLocale.php \Drupal\price\CurrentLocale::getLocale()
- 2.0.x src/CurrentLocale.php \Drupal\price\CurrentLocale::getLocale()
- 2.x src/CurrentLocale.php \Drupal\price\CurrentLocale::getLocale()
- 3.0.x src/CurrentLocale.php \Drupal\price\CurrentLocale::getLocale()
Gets the locale for the current request.
Return value
\Drupal\price\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\priceCode
public function getLocale() {
$request = $this->requestStack
->getCurrentRequest();
if (!$this->locales
->contains($request)) {
$this->locales[$request] = $this->chainResolver
->resolve();
}
return $this->locales[$request];
}