Beispiel #1
0
 /**
  * Retrieve locale object
  *
  * @return \Magento\Framework\LocaleInterface
  */
 public function getLocale()
 {
     $locale = $this->getData('locale');
     if (null === $locale) {
         $locale = $this->_localeResolver->setLocaleCode($this->getLocaleCode())->getLocale();
         $this->setData('locale', $locale);
     }
     return $locale;
 }
Beispiel #2
0
 /**
  * Restore locale of the initial store
  *
  * @param string $initialLocaleCode
  * @param string $initialArea
  * @return $this
  */
 protected function _restoreInitialLocale($initialLocaleCode, $initialArea = \Magento\Framework\App\Area::AREA_ADMIN)
 {
     $this->_localeResolver->setLocaleCode($initialLocaleCode);
     $this->_translate->setLocale($initialLocaleCode)->loadData($initialArea, true);
     return $this;
 }