t() public static méthode

public static t ( $key, $params = [], PluralizeOption $pluralize = null )
$pluralize PluralizeOption
Exemple #1
0
 /**
  * @test
  */
 public function shouldTranslateValueInDefaultLanguageWhenNoLanguageWasSet()
 {
     //when
     $translation = I18n::t('product.description');
     //then
     $this->assertEquals('Product description', $translation);
 }
 public function asString()
 {
     $key = $this->timeAgo->getKey();
     $params = $this->timeAgo->getParams();
     if (Strings::equal($key, 'timeAgo.thisYear')) {
         $params['month'] = I18n::t($params['month']);
     }
     return I18n::t($key, $params);
 }
 public static function _checkCredentials($authUser, $authPassword, $realm)
 {
     $login = Arrays::getValue($_SERVER, 'PHP_AUTH_USER');
     $pass = Arrays::getValue($_SERVER, 'PHP_AUTH_PW');
     if ($authUser != $login || $authPassword != $pass) {
         $code = defined('UNAUTHORIZED') ? UNAUTHORIZED : 0;
         $error = new Error($code, I18n::t('exception.unauthorized'));
         throw new UnauthorizedException($error, array('WWW-Authenticate: Basic realm="' . $realm . '"'));
     }
     return true;
 }
Exemple #4
0
 public static function getByCode($code, $params = array(), $prefix = 'errors.')
 {
     $message = I18n::t($prefix . $code, $params);
     return new Error($code, $message);
 }
Exemple #5
0
 private static function _throwException()
 {
     throw new ForbiddenException(new Error(defined('UNAUTHORIZED') ? UNAUTHORIZED : 0, I18n::t('exception.forbidden')));
 }
Exemple #6
0
 private function _translate($field)
 {
     return I18n::t($this->_objectName() . '.' . $field);
 }
Exemple #7
0
function t($textKey, $params = array(), PluralizeOption $pluralize = null)
{
    return I18n::t($textKey, $params, $pluralize);
}