本文整理汇总了PHP中Mage_Core_Model_App::getLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_App::getLocale方法的具体用法?PHP Mage_Core_Model_App::getLocale怎么用?PHP Mage_Core_Model_App::getLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_App
的用法示例。
在下文中一共展示了Mage_Core_Model_App::getLocale方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _restoreInitialLocale
/**
* Restore locale of the initial store
*
* @param string $initialLocaleCode
* @param string $initialArea
*
* @return Mage_Core_Model_App_Emulation
*/
protected function _restoreInitialLocale($initialLocaleCode, $initialArea = Mage_Core_Model_App_Area::AREA_ADMINHTML)
{
$currentLocaleCode = $this->_app->getLocale()->getLocaleCode();
if ($currentLocaleCode != $initialLocaleCode) {
$this->_app->getLocale()->setLocaleCode($initialLocaleCode);
$this->_factory->getSingleton('core/translate')->setLocale($initialLocaleCode)->init($initialArea, true);
}
return $this;
}
示例2: _setAndValidateDateExpires
/**
* This function validates and operates on 'date expires' field of a gift card.
*
* @throws Mage_Core_Exception
* @return Mage_Core_Model_Abstract
*/
protected function _setAndValidateDateExpires()
{
if (is_numeric($this->getLifetime()) && $this->getLifetime() > 0) {
$this->setDateExpires(date('Y-m-d', strtotime("now +{$this->getLifetime()}days")));
} else {
if ($this->getDateExpires()) {
$expirationDate = $this->_app->getLocale()->date($this->getDateExpires(), Varien_Date::DATE_INTERNAL_FORMAT, null, false);
$currentDate = $this->_app->getLocale()->date(null, Varien_Date::DATE_INTERNAL_FORMAT, null, false);
if ($expirationDate < $currentDate) {
throw new Mage_Core_Exception($this->helper('enterprise_giftcardaccount')->__('Expiration date cannot be in the past.'));
}
} else {
$this->setDateExpires(null);
}
}
return $this;
}
示例3: testGetLocale
public function testGetLocale()
{
$locale = $this->_model->getLocale();
$this->assertInstanceOf('Mage_Core_Model_Locale', $locale);
$this->assertSame($locale, $this->_model->getLocale());
}
示例4: printOptions
/**
* Print available currency, locale and timezone options
*
* @return Mage_Install_Model_Installer_Console
*/
public function printOptions()
{
$options = array('locale' => $this->_app->getLocale()->getOptionLocales(), 'currency' => $this->_app->getLocale()->getOptionCurrencies(), 'timezone' => $this->_app->getLocale()->getOptionTimezones());
var_export($options);
return $this;
}
示例5: getPriceFormat
/**
* Get prices javascript format json
*
* @param mixed $store
* @return string
*/
public function getPriceFormat($store = null)
{
$this->_app->getLocale()->emulate($store);
$priceFormat = $this->_app->getLocale()->getJsPriceFormat();
$this->_app->getLocale()->revert();
if ($store) {
$priceFormat['pattern'] = $this->_app->getStore($store)->getCurrentCurrency()->getOutputFormat();
}
return Mage::helper('core')->jsonEncode($priceFormat);
}