本文整理汇总了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;
}