本文整理匯總了PHP中Zend_Translate_Adapter::setLocale方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Translate_Adapter::setLocale方法的具體用法?PHP Zend_Translate_Adapter::setLocale怎麽用?PHP Zend_Translate_Adapter::setLocale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Translate_Adapter
的用法示例。
在下文中一共展示了Zend_Translate_Adapter::setLocale方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testDiffReadableBeforeAndAfterLocalised
public function testDiffReadableBeforeAndAfterLocalised()
{
$this->translate->setLocale('nl');
$this->object = new \MUtil_Date('2010-05-13 12:00:00');
$testDate = new \MUtil_Date('2010-05-13 12:00:10');
$this->assertEquals('10 seconden geleden', $this->object->diffReadable($testDate, $this->translate));
$testDate = new \MUtil_Date('2010-05-13 11:59:50');
$this->assertEquals('over 10 seconden', $this->object->diffReadable($testDate, $this->translate));
$testDate = new \MUtil_Date('2010-05-13 12:00:00');
$this->assertEquals('over 0 seconden', $this->object->diffReadable($testDate, $this->translate));
}
示例2: setLocale
/**
* @param string|\Zend_Locale $locale
* @return \Zend_Translate_Adapter
* @throws \Zend_Translate_Exception
*/
public function setLocale($locale)
{
// load data before calling the parent
$l = (string) $locale;
if (empty($this->_translate[$l])) {
$this->_loadTranslationData(null, $l);
}
return parent::setLocale($locale);
}
示例3: setLocale
/**
* Sets a new locale/language
*
* @param string|Zend_Locale $locale Locale/Language to set for translations
*/
public function setLocale($locale)
{
$this->_adapter->setLocale($locale);
}