/** * Loads current user's locale or, if none exists, the default fallback * * @return \Shopware\Models\Shop\Locale */ protected function getCurrentLocale() { $options = $this->Application()->getOption('backendSession', array()); $options = $this->prepareSessionOptions($options); Enlight_Components_Session::setOptions($options); if (Enlight_Components_Session::sessionExists()) { $auth = Shopware()->Auth(); if ($auth->hasIdentity()) { $user = $auth->getIdentity(); if (isset($user->locale)) { return $user->locale; } } } $default = $this->getDefaultLocale(); $locale = Shopware()->Models()->getRepository('Shopware\\Models\\Shop\\Locale')->find($default); return $locale; }