Skip to content
Snippets Groups Projects
Commit bd09881e authored by Thijs Kinkhorst's avatar Thijs Kinkhorst
Browse files

Remove language[priorities]. It's been hardly used in the code.

We could use it everywhere, but it's better to reduce the already big
amount of configuration options the admin is confronted with than the
small problem this option solves.
parent 29985adf
No related branches found
No related tags found
No related merge requests found
......@@ -733,41 +733,6 @@ $config = [
| LANGUAGE AND INTERNATIONALIZATION |
*************************************/
/*
* Language-related options.
*/
'language' => [
/*
* An array in the form 'language' => <list of alternative languages>.
*
* Each key in the array is the ISO 639 two-letter code for a language,
* and its value is an array with a list of alternative languages that
* can be used if the given language is not available at some point.
* Each alternative language is also specified by its ISO 639 code.
*
* For example, for the "no" language code (Norwegian), we would have:
*
* 'priorities' => [
* 'no' => ['nb', 'nn', 'en', 'se'],
* ...
* ],
*
* establishing that if a translation for the "no" language code is
* not available, we look for translations in "nb",
* and so on, in that order.
*/
'priorities' => [
'no' => ['nb', 'nn', 'en', 'se'],
'nb' => ['no', 'nn', 'en', 'se'],
'nn' => ['no', 'nb', 'en', 'se'],
'se' => ['nb', 'no', 'nn', 'en'],
'nr' => ['zu', 'en'],
'nd' => ['zu', 'en'],
'tw' => ['st', 'en'],
'nso' => ['st', 'en'],
],
],
/*
* Languages available, RTL languages, and what language is the default.
*/
......
......@@ -49,3 +49,6 @@ Upgrade notes for SimpleSAMLphp 2.0
- lib/SimpleSAML/Store/SQL.php has been renamed to lib/SimpleSAML/Store/SQLStore.php
- lib/SimpleSAML/Store/Memcache.php has been renamed to lib/SimpleSAML/Store/MemcacheStore.php
- lib/SimpleSAML/Store/Redis.php has been renamed to lib/SimpleSAML/Store/RedisStore.php
- Configuration options removed:
- languages[priorities]
......@@ -393,20 +393,6 @@ class Translate
return $translations[$context['currentLanguage']];
}
// we don't have a translation for the current language, load alternative priorities
$sspcfg = Configuration::getInstance();
/** @psalm-var \SimpleSAML\Configuration $langcfg */
$langcfg = $sspcfg->getConfigItem('language');
$priorities = $langcfg->getArray('priorities', []);
if (!empty($priorities[$context['currentLanguage']])) {
foreach ($priorities[$context['currentLanguage']] as $lang) {
if (isset($translations[$lang])) {
return $translations[$lang];
}
}
}
// nothing we can use, return null so that we can set a default
return null;
}
......
......@@ -90,7 +90,7 @@ class TemplateTest extends TestCase
$c = Configuration::loadFromArray([], '', 'simplesaml');
$t = new Template($c, self::TEMPLATE);
$prop = 'description';
$prop = 'description';
$data = [
'entityid' => 'urn:example.org',
$prop => ['nl' => 'Something', 'en' => 'Other lang', 'fr' => 'Another desc'],
......@@ -103,11 +103,11 @@ class TemplateTest extends TestCase
$name = $t->getEntityPropertyTranslation($prop, $data);
$this->assertEquals('Something', $name);
unset($data[$prop]['nl']);
unset($data[$prop]['nl']);
$name = $t->getEntityPropertyTranslation($prop, $data);
$this->assertEquals('Other lang', $name);
unset($data[$prop]['en']);
unset($data[$prop]['en']);
$name = $t->getEntityPropertyTranslation($prop, $data);
$this->assertNull($name);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment