diff --git a/config-templates/config.php b/config-templates/config.php index dc63b94ed3172d6cddccbdef3b0435007e863d24..0e82fb130a6e5eb299489e1cf8a1666cea7d635a 100644 --- a/config-templates/config.php +++ b/config-templates/config.php @@ -277,6 +277,12 @@ $config = array ( 'language.rtl' => array('ar','dv','fa','ur','he'), 'language.default' => 'en', + /* + * Options to override the default settings for the language parameter + */ + 'language.parameter.name' => 'language', + 'language.parameter.setcookie' => TRUE, + /* * Options to override the default settings for the language cookie */ diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index b58af7e2135e5c8fe3f58b1235ec2ac887e12dea..9bb4759498d8b89c596468ad8f538e520bc3c049 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -38,6 +38,12 @@ class SimpleSAML_XHTML_Template { private $defaultDictionary = NULL; + /** + * HTTP GET language parameter name. + */ + private $languageParameterName = 'language'; + + /** * Constructor * @@ -52,9 +58,10 @@ class SimpleSAML_XHTML_Template { $this->data['baseurlpath'] = $this->configuration->getBaseURL(); $this->availableLanguages = $this->configuration->getArray('language.available', array('en')); - - if (isset($_GET['language'])) { - $this->setLanguage($_GET['language']); + + $this->languageParameterName = $this->configuration->getString('language.parameter.name', 'language'); + if (isset($_GET[$this->languageParameterName])) { + $this->setLanguage($_GET[$this->languageParameterName], $this->configuration->getBoolean('language.parameter.setcookie', TRUE)); } if($defaultDictionary !== NULL && substr($defaultDictionary, -4) === '.php') { diff --git a/templates/includes/header.php b/templates/includes/header.php index 692f21fd01b947fe73fc9d11eb4ea17e2c710a2e..4dd83e423934f3073fa71e5653e3f2b5c0e1e5a0 100644 --- a/templates/includes/header.php +++ b/templates/includes/header.php @@ -193,7 +193,7 @@ if($onLoad !== '') { if ($current) { $textarray[] = $langnames[$lang]; } else { - $textarray[] = '<a href="' . htmlspecialchars(SimpleSAML_Utilities::addURLparameter(SimpleSAML_Utilities::selfURL(), array('language' => $lang))) . '">' . + $textarray[] = '<a href="' . htmlspecialchars(SimpleSAML_Utilities::addURLparameter(SimpleSAML_Utilities::selfURL(), array($this->languageParameterName => $lang))) . '">' . $langnames[$lang] . '</a>'; } }