Skip to content
Snippets Groups Projects
Commit 818d6bca authored by Hanne Moa's avatar Hanne Moa
Browse files

Deprecate fallbackdefault argument

For #455
parent 3289d203
No related branches found
No related tags found
No related merge requests found
...@@ -251,7 +251,7 @@ class Translate ...@@ -251,7 +251,7 @@ class Translate
* (language => text) mappings. * (language => text) mappings.
* @param array $replacements An associative array of keys that should be replaced with values in the * @param array $replacements An associative array of keys that should be replaced with values in the
* translated string. * translated string.
* @param boolean $fallbackdefault Default translation to use as a fallback if no valid translation was found. * @param boolean $fallbackdefault Default translation to use as a fallback if no valid translation was found. @deprecated Not used in twig, gettext
* *
* @return string The translated tag, or a placeholder value if the tag wasn't found. * @return string The translated tag, or a placeholder value if the tag wasn't found.
*/ */
...@@ -262,14 +262,21 @@ class Translate ...@@ -262,14 +262,21 @@ class Translate
$oldreplacements = array(), // TODO: remove this for 2.0 $oldreplacements = array(), // TODO: remove this for 2.0
$striptags = false // TODO: remove this for 2.0 $striptags = false // TODO: remove this for 2.0
) { ) {
$backtrace = debug_backtrace();
$where = $backtrace[0]['file'].':'.$backtrace[0]['line'];
if (!$fallbackdefault) {
\SimpleSAML\Logger::warning(
'Deprecated use of new SimpleSAML\Locale\Translate::t(...) at '.$where.
'. This parameter will go away, the fallback will become' .
' identical to the $tag in 2.0.'
);
}
if (!is_array($replacements)) { if (!is_array($replacements)) {
// TODO: remove this entire if for 2.0 // TODO: remove this entire if for 2.0
// old style call to t(...). Print warning to log // old style call to t(...). Print warning to log
$backtrace = debug_backtrace();
$where = $backtrace[0]['file'].':'.$backtrace[0]['line'];
\SimpleSAML\Logger::warning( \SimpleSAML\Logger::warning(
'Deprecated use of SimpleSAML_Template::t(...) at '.$where. 'Deprecated use of SimpleSAML\Locale\Translate::t(...) at '.$where.
'. Please update the code to use the new style of parameters.' '. Please update the code to use the new style of parameters.'
); );
......
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