/**
  * Test SimpleSAML\Locale\Translate::t().
  */
 public function testTFallback()
 {
     $c = \SimpleSAML_Configuration::loadFromArray(array());
     $t = new Translate($c);
     $testString = 'Blablabla';
     // $fallbackdefault = true
     $result = 'not translated (' . $testString . ')';
     $this->assertEquals($result, $t->t($testString));
     // $fallbackdefault = false, should be a noop
     $this->assertEquals($testString, $t->t($testString, array(), false));
 }
Esempio n. 2
0
 /**
  * Wrap Language->t to translate tag into the current language, with a fallback to english.
  *
  * @see \SimpleSAML\Locale\Translate::t()
  * @deprecated This method will be removed in SSP 2.0. Please use \SimpleSAML\Locale\Translate::t() instead.
  */
 public function t($tag, $replacements = array(), $fallbackdefault = true, $oldreplacements = array(), $striptags = false)
 {
     return $this->translator->t($tag, $replacements, $fallbackdefault, $oldreplacements, $striptags);
 }
Esempio n. 3
0
 /**
  * Fetch all default translation strings for error code descriptions.
  *
  * @return string A map from error code to error code description
  */
 public static final function defaultGetAllErrorCodeDescriptions()
 {
     return array('ACSPARAMS' => \SimpleSAML\Locale\Translate::noop('{errors:descr_ACSPARAMS}'), 'ARSPARAMS' => \SimpleSAML\Locale\Translate::noop('{errors:descr_ARSPARAMS}'), 'AUTHSOURCEERROR' => \SimpleSAML\Locale\Translate::noop('{errors:descr_AUTHSOURCEERROR}'), 'BADREQUEST' => \SimpleSAML\Locale\Translate::noop('{errors:descr_BADREQUEST}'), 'CASERROR' => \SimpleSAML\Locale\Translate::noop('{errors:descr_CASERROR}'), 'CONFIG' => \SimpleSAML\Locale\Translate::noop('{errors:descr_CONFIG}'), 'CREATEREQUEST' => \SimpleSAML\Locale\Translate::noop('{errors:descr_CREATEREQUEST}'), 'DISCOPARAMS' => \SimpleSAML\Locale\Translate::noop('{errors:descr_DISCOPARAMS}'), 'GENERATEAUTHNRESPONSE' => \SimpleSAML\Locale\Translate::noop('{errors:descr_GENERATEAUTHNRESPONSE}'), 'INVALIDCERT' => \SimpleSAML\Locale\Translate::noop('{errors:descr_INVALIDCERT}'), 'LDAPERROR' => \SimpleSAML\Locale\Translate::noop('{errors:descr_LDAPERROR}'), 'LOGOUTINFOLOST' => \SimpleSAML\Locale\Translate::noop('{errors:descr_LOGOUTINFOLOST}'), 'LOGOUTREQUEST' => \SimpleSAML\Locale\Translate::noop('{errors:descr_LOGOUTREQUEST}'), 'MEMCACHEDOWN' => \SimpleSAML\Locale\Translate::noop('{errors:descr_MEMCACHEDOWN}'), 'METADATA' => \SimpleSAML\Locale\Translate::noop('{errors:descr_METADATA}'), 'METADATANOTFOUND' => \SimpleSAML\Locale\Translate::noop('{errors:descr_METADATANOTFOUND}'), 'NOACCESS' => \SimpleSAML\Locale\Translate::noop('{errors:descr_NOACCESS}'), 'NOCERT' => \SimpleSAML\Locale\Translate::noop('{errors:descr_NOCERT}'), 'NORELAYSTATE' => \SimpleSAML\Locale\Translate::noop('{errors:descr_NORELAYSTATE}'), 'NOSTATE' => \SimpleSAML\Locale\Translate::noop('{errors:descr_NOSTATE}'), 'NOTFOUND' => \SimpleSAML\Locale\Translate::noop('{errors:descr_NOTFOUND}'), 'NOTFOUNDREASON' => \SimpleSAML\Locale\Translate::noop('{errors:descr_NOTFOUNDREASON}'), 'NOTSET' => \SimpleSAML\Locale\Translate::noop('{errors:descr_NOTSET}'), 'NOTVALIDCERT' => \SimpleSAML\Locale\Translate::noop('{errors:descr_NOTVALIDCERT}'), 'PROCESSASSERTION' => \SimpleSAML\Locale\Translate::noop('{errors:descr_PROCESSASSERTION}'), 'PROCESSAUTHNREQUEST' => \SimpleSAML\Locale\Translate::noop('{errors:descr_PROCESSAUTHNREQUEST}'), 'RESPONSESTATUSNOSUCCESS' => \SimpleSAML\Locale\Translate::noop('{errors:descr_RESPONSESTATUSNOSUCCESS}'), 'SLOSERVICEPARAMS' => \SimpleSAML\Locale\Translate::noop('{errors:descr_SLOSERVICEPARAMS}'), 'SSOPARAMS' => \SimpleSAML\Locale\Translate::noop('{errors:descr_SSOPARAMS}'), 'UNHANDLEDEXCEPTION' => \SimpleSAML\Locale\Translate::noop('{errors:descr_UNHANDLEDEXCEPTION}'), 'UNKNOWNCERT' => \SimpleSAML\Locale\Translate::noop('{errors:descr_UNKNOWNCERT}'), 'USERABORTED' => \SimpleSAML\Locale\Translate::noop('{errors:descr_USERABORTED}'), 'WRONGUSERPASS' => \SimpleSAML\Locale\Translate::noop('{errors:descr_WRONGUSERPASS}'));
 }