/**
  * Returns the context item for backend operations
  *
  * @param array $templatePaths List of paths to the view templates
  * @return \Aimeos\MShop\Context\Item\Iface Context item
  */
 protected function getContextBackend(array $templatePaths = array(), $withView = true)
 {
     if (!isset($this->contextBE)) {
         $lang = 'en';
         $site = 'default';
         if (isset($GLOBALS['BE_USER']->uc['lang']) && $GLOBALS['BE_USER']->uc['lang'] != '') {
             $lang = $GLOBALS['BE_USER']->uc['lang'];
         }
         if ($this->request->hasArgument('lang')) {
             $lang = $this->request->getArgument('lang');
         }
         if ($this->request->hasArgument('site')) {
             $site = $this->request->getArgument('site');
         }
         $config = Base::getConfig((array) $this->settings);
         $context = Base::getContext($config);
         $locale = Base::getLocaleBackend($context, $site);
         $context->setLocale($locale);
         $i18n = Base::getI18n(array($lang, 'en'), $config->get('i18n', array()));
         $context->setI18n($i18n);
         if ($withView) {
             $view = Base::getView($config, $this->uriBuilder, $templatePaths, $this->request, $lang, false);
             $context->setView($view);
         }
         $this->contextBE = $context;
     }
     return $this->contextBE;
 }