From ab289eb5c120da114795b6e7c3d102df84b50f54 Mon Sep 17 00:00:00 2001
From: Ralf Becker <RalfBecker@outdoor-training.de>
Date: Wed, 4 Mar 2020 21:15:07 +0100
Subject: [PATCH] fix some errors in new phpUnit tests: define lang() only if
 not already done

---
 setup/inc/functions.inc.php | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/setup/inc/functions.inc.php b/setup/inc/functions.inc.php
index e24cbd8a9f..819e7df8ae 100644
--- a/setup/inc/functions.inc.php
+++ b/setup/inc/functions.inc.php
@@ -56,14 +56,17 @@ require_once(EGW_INCLUDE_ROOT . '/api/src/loader/common.php');
  * function to handle multilanguage support
  *
  */
-function lang($key,$vars=null)
+if (!function_exists('lang'))
 {
-	if(!is_array($vars))
+	function lang($key, $vars = null)
 	{
-		$vars = func_get_args();
-		array_shift($vars);	// remove $key
+		if (!is_array($vars))
+		{
+			$vars = func_get_args();
+			array_shift($vars);    // remove $key
+		}
+		return $GLOBALS['egw_setup']->translation->translate("$key", $vars);
 	}
-	return $GLOBALS['egw_setup']->translation->translate("$key", $vars);
 }
 
 if(file_exists(EGW_SERVER_ROOT.'/api/setup/setup.inc.php'))