コード例 #1
0
ファイル: Locale.php プロジェクト: aiesh/magento2
 /**
  * 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;
 }
コード例 #2
0
ファイル: Emulation.php プロジェクト: pavelnovitsky/magento2
 /**
  * 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;
 }