setLanguage() public method

This method will set a cookie for the user's browser to remember what language was selected.
public setLanguage ( string $language, boolean $setLanguageCookie = true )
$language string Language code for the language to set.
$setLanguageCookie boolean Whether to set the language cookie or not. Defaults to true.
Ejemplo n.º 1
0
 /**
  * Test SimpleSAML\Locale\Language::isLanguageRTL().
  */
 public function testIsLanguageRTL()
 {
     // test defaults
     $c = \SimpleSAML_Configuration::loadFromArray(array(), '', 'simplesaml');
     $l = new Language($c);
     $l->setLanguage('en');
     $this->assertFalse($l->isLanguageRTL());
     // test non-defaults, non-RTL
     $c = \SimpleSAML_Configuration::loadFromArray(array('language.rtl' => array('foo', 'bar')), '', 'simplesaml');
     $l = new Language($c);
     $l->setLanguage('en');
     $this->assertFalse($l->isLanguageRTL());
     // test non-defaults, RTL
     $c = \SimpleSAML_Configuration::loadFromArray(array('language.available' => array('en', 'nn', 'es'), 'language.rtl' => array('nn', 'es')), '', 'simplesaml');
     $l = new Language($c);
     $l->setLanguage('es');
     $this->assertTrue($l->isLanguageRTL());
 }