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