From 571b58c09e9dae8ff93f646455110764789847f5 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Fri, 4 Feb 2011 23:50:18 +0000
Subject: [PATCH] Optimize speed

---
 htdocs/lib/functions.lib.php | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index ae5dd4c3d22..69b59b774de 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -3459,11 +3459,11 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok')
 	global $langs;
 
 	$ret = 0;
-	$langs->load("errors");
 
 	if (is_array($mesgarray) && sizeof($mesgarray))
 	{
-		print '<div class="'.$style.'">';
+        $langs->load("errors");
+	    print '<div class="'.$style.'">';
 		foreach($mesgarray as $message)
 		{
 			$ret++;
@@ -3473,7 +3473,8 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok')
 	}
 	if ($mesgstring)
 	{
-		$ret++;
+        $langs->load("errors");
+	    $ret++;
 		print '<div class="'.$style.'">';
 		print $langs->trans($mesgstring);
 		print '</div>';
-- 
GitLab