本文整理匯總了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;
}