本文整理匯總了PHP中Zend_Locale::__toString方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Locale::__toString方法的具體用法?PHP Zend_Locale::__toString怎麽用?PHP Zend_Locale::__toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Locale
的用法示例。
在下文中一共展示了Zend_Locale::__toString方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getLocale
/**
* Retrieve locale object
*
* @return Zend_Locale
*/
public function getLocale()
{
if (!$this->_locale) {
$this->setLocale();
} elseif ($this->_locale->__toString() != $this->_localeCode) {
$this->setLocale($this->_localeCode);
}
return $this->_locale;
}
示例2: getLocale
/**
* Retrieve locale object
*
* @return Zend_Locale
*/
public function getLocale()
{
if (!$this->_locale) {
Zend_Locale_Data::setCache(Mage::app()->getCache());
$this->_locale = new Zend_Locale($this->getLocaleCode());
} elseif ($this->_locale->__toString() != $this->_localeCode) {
$this->setLocale($this->_localeCode);
}
return $this->_locale;
}
示例3: testToString
/**
* test toString
* expected string
*/
public function testToString()
{
$value = new Zend_Locale('de_DE');
$this->assertEquals('de_DE', $value->toString());
$this->assertEquals('de_DE', $value->__toString());
}
示例4: testToString
/**
* test toString
* expected string
*/
public function testToString()
{
$value = new Zend_Locale('de_DE');
$this->assertEquals($value->toString(), 'de_DE', 'Locale de_DE expected');
$this->assertEquals($value->__toString(), 'de_DE', 'Value de_DE expected');
}
示例5: setLocale
/**
* Set current locale in Zend_Locale::setDefault(), Zend_Registry and
* Adapter.
*
* @param Zend_Locale|string $locale
*/
public static function setLocale($locale = null)
{
if (!$locale) {
$locale = self::findLocale();
}
if (is_string($locale)) {
try {
$locale = new Zend_Locale($locale);
if ($locale->__toString() == 'root') {
$locale = self::getDefaultLocale();
}
} catch (Exception $e) {
$locale = new Zend_Locale();
}
}
try {
Zend_Locale::setDefault($locale);
} catch (Exception $e) {
Zend_Locale::setDefault(self::getDefaultLocale());
}
Zend_Registry::set('Zend_Locale', $locale);
$adapter = self::getAdapter();
$adapter->locale = (string) $locale;
self::$locale = $locale;
}