/** * @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; }
public static function getByCode($code, $params = array(), $prefix = 'errors.') { $message = I18n::t($prefix . $code, $params); return new Error($code, $message); }
private static function _throwException() { throw new ForbiddenException(new Error(defined('UNAUTHORIZED') ? UNAUTHORIZED : 0, I18n::t('exception.forbidden'))); }
private function _translate($field) { return I18n::t($this->_objectName() . '.' . $field); }
function t($textKey, $params = array(), PluralizeOption $pluralize = null) { return I18n::t($textKey, $params, $pluralize); }