本文整理汇总了PHP中Solar_Base::locale方法的典型用法代码示例。如果您正苦于以下问题:PHP Solar_Base::locale方法的具体用法?PHP Solar_Base::locale怎么用?PHP Solar_Base::locale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Solar_Base
的用法示例。
在下文中一共展示了Solar_Base::locale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _chainLocale
/**
*
* Uses the chain locale object to get translations before falling back
* to this object for locale.
*
* @param string $key The translation key, typically a validation method
* name.
*
* @return string
*
*/
protected function _chainLocale($key)
{
// the translated message; default to the translation key.
$msg = $key;
// if we have a locale object, get a message from it
if ($this->_chain_locale_object) {
// try to translate
$msg = $this->_chain_locale_object->locale($key);
// if the key failed to translate, fall back to the
// translations from $this, but only if $this wasn't
// the source to begin with.
$failed = $msg === null || $msg == $key;
if ($failed && $this != $this->_chain_locale_object) {
$msg = $this->locale($key);
}
}
// done
return $msg;
}