diff --git a/config-templates/config.php b/config-templates/config.php index 7222376caa105e1b11965780488e910239abbe51..77d0604e56ee15a85227c627d8630505cf8746cc 100644 --- a/config-templates/config.php +++ b/config-templates/config.php @@ -202,7 +202,33 @@ $config = array ( */ 'language.available' => array('en', 'no', 'nn', 'se', 'da', 'de', 'sv', 'fi', 'es', 'fr', 'it', 'nl', 'lb', 'cs', 'sl', 'lt', 'hr', 'hu', 'pl', 'pt', 'pt-BR', 'tr'), 'language.default' => 'en', - + + /* + * Extra dictionary for attribute names. + * This can be used to define local attributes. + * + * The format of the parameter is a string with <module>:<dictionary>. + * + * Specifying this option will cause us to look for modules/<module>/dictionaries/<dictionary>.definition.json + * The dictionary should look something like: + * + * { + * "firstattribute": { + * "en": "English name", + * "no": "Norwegian name" + * }, + * "secondattribute": { + * "en": "English name", + * "no": "Norwegian name" + * } + * } + * + * Note that all attribute names in the dictionary must in lowercase. + * + * Example: 'attributes.extradictionary' => 'ourmodule:ourattributes', + */ + 'attributes.extradictionary' => NULL, + /* * Which theme directory should be used? */ diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index e92684813334edbff51f9fe956e6b157d92ccad7..03fe5e2867267c627fb65882ecc403b560501354 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -307,6 +307,15 @@ class SimpleSAML_XHTML_Template { $normName = strtolower($name); $normName = str_replace(":", "_", $normName); + /* Check for an extra dictionary. */ + $extraDict = $this->configuration->getString('attributes.extradictionary', NULL); + if ($extraDict !== NULL) { + $dict = $this->getDictionary($extraDict); + if (array_key_exists($normName, $dict)) { + return $this->getTranslation($dict[$normName]); + } + } + /* Search the default attribute dictionary. */ $dict = $this->getDictionary('attributes'); if (array_key_exists('attribute_' . $normName, $dict)) {