Skip to content
Snippets Groups Projects
Commit ac82674f authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Return lang_merge() to SimpleSAML_XHTML_Template, as it was public, and mark...

Return lang_merge() to SimpleSAML_XHTML_Template, as it was public, and mark it as deprecated. Use array_merge_recursive() instead.
parent bbf1348d
No related branches found
No related tags found
No related merge requests found
......@@ -365,7 +365,7 @@ class Translate
$fileContent = file_get_contents($translationFile);
$moreTrans = json_decode($fileContent, true);
if (!empty($moreTrans)) {
$lang = self::lang_merge($lang, $moreTrans);
$lang = array_merge_recursive($lang, $moreTrans);
}
}
......@@ -423,16 +423,4 @@ class Translate
);
return array();
}
// Merge two translation arrays.
public static function lang_merge($def, $lang)
{
foreach ($def as $key => $value) {
if (array_key_exists($key, $lang)) {
$def[$key] = array_merge($value, $lang[$key]);
}
}
return $def;
}
}
......@@ -78,6 +78,25 @@ class SimpleSAML_XHTML_Template
}
/**
* Merge two translation arrays.
*
* @param array $def The array holding string definitions.
* @param array $lang The array holding translations for every string.
* @return array The recursive merge of both arrays.
* @deprecated This method will be removed in SimpleSAMLphp 2.0. Please use array_merge_recursive() instead.
*/
public static function lang_merge($def, $lang)
{
foreach ($def as $key => $value) {
if (array_key_exists($key, $lang)) {
$def[$key] = array_merge($value, $lang[$key]);
}
}
return $def;
}
/**
* Find template path.
*
......
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