Aimeos\ShopBundle\Service\Locale::get PHP Method

get() public method

Returns the locale item for the current request
public get ( Aimeos\MShop\Context\Item\Iface $context ) : Aimeos\MShop\Locale\Item\Iface
$context Aimeos\MShop\Context\Item\Iface Context object
return Aimeos\MShop\Locale\Item\Iface Locale item object
    public function get(\Aimeos\MShop\Context\Item\Iface $context)
    {
        if ($this->locale === null) {
            $status = $this->container->getParameter('aimeos_shop.disable_sites');
            $request = $this->requestStack->getMasterRequest();
            $site = $request->attributes->get('site', $request->query->get('site', 'default'));
            $currency = $request->attributes->get('currency', $request->query->get('currency', ''));
            $lang = $request->attributes->get('locale', $request->query->get('locale', ''));
            $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
            $this->locale = $localeManager->bootstrap($site, $lang, $currency, $status);
        }
        return $this->locale;
    }