From c601834e560f7f81a7f11eae9ada30f3084a3708 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Tue, 23 Feb 2010 20:30:55 +0000
Subject: [PATCH] Fix: Numbers works with ar_AR language

---
 htdocs/admin/system/dolibarr.php |  1 +
 htdocs/langs/ar_AR/main.lang     | 25 ++++---------------------
 htdocs/lib/functions.lib.php     |  5 ++++-
 htdocs/translate.class.php       |  2 +-
 4 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php
index 9a0f8ec0458..aae260da31a 100644
--- a/htdocs/admin/system/dolibarr.php
+++ b/htdocs/admin/system/dolibarr.php
@@ -143,6 +143,7 @@ print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("LanguageParameter","
 $var=!$var;
 $thousand=$langs->trans("SeparatorThousand");
 if ($thousand == 'SeparatorThousand') $thousand=' ';	// ' ' does not work on trans method
+if ($thousand == 'None') $thousand='';
 print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("CurrentValueSeparatorThousand")."</td><td>".($thousand==' '?$langs->trans("Space"):$thousand)."</td></tr>\n";
 // Decimals
 $var=!$var;
diff --git a/htdocs/langs/ar_AR/main.lang b/htdocs/langs/ar_AR/main.lang
index b338af77ad0..85a48a566a8 100644
--- a/htdocs/langs/ar_AR/main.lang
+++ b/htdocs/langs/ar_AR/main.lang
@@ -4,14 +4,13 @@
  * Generation date 2009-08-11 13:27:01
  */
 
-
 // Date 2009-08-11 13:27:01
 // START - Lines generated via autotranslator.php tool.
 // Reference language: en_US
 CHARSET=UTF-8
 DIRECTION=rtl
 SeparatorDecimal=.
-SeparatorThousand=،
+SeparatorThousand=None
 FormatDateShort=%d/%m/%Y
 FormatDateShortJava=dd/MM/yyyy
 FormatHourShort=%H:%M
@@ -26,9 +25,9 @@ ErrorFieldRequired=الميدان &#39;٪ ق&#39; مطلوب
 ErrorFieldFormat=الميدان &#39;٪ ق&#39; سيئة القيمة
 ErrorFileDoesNotExists=ملف ٪ ق لا يوجد
 ErrorFailedToOpenFile=فشل في فتح الملف ٪ ق
-ErrorCanNotCreateDir=لا يمكن إنشاء دير ق ٪
-ErrorCanNotReadDir=لا يمكن قراءة دير ق ٪
-ErrorConstantNotDefined=معلمة ٪ ق لم تحدد
+ErrorCanNotCreateDir=لا يمكن إنشاء دير ق
+ErrorCanNotReadDir=لا يمكن قراءة دير ق
+ErrorConstantNotDefined=معلمة ٪s ق لم تحدد
 ErrorUnknown=Unkown خطأ
 ErrorSQL=خطأ SQL
 ErrorLogoFileNotFound=شعار ملف &#39;٪ ق&#39; لم يتم العثور على
@@ -540,28 +539,12 @@ ShortThursday=تي
 ShortFriday=واو
 ShortSaturday=دإ
 ShortSunday=دإ
-// Date 2009-08-11 13:27:01
-// STOP - Lines generated via parser
-
-
-// START - Lines generated via autotranslator.php tool (2009-08-13 20:22:26).
-// Reference language: en_US
 Login=تسجيل الدخول
-// STOP - Lines generated via autotranslator.php tool (2009-08-13 20:22:26).
-
-
-// START - Lines generated via autotranslator.php tool (2009-08-13 20:38:53).
-// Reference language: en_US
 ErrorGoToGlobalSetup=اذهب إلى &#39;شركة / مؤسسة&#39; الإعداد لتثبيت هذا
 ErrorFailedToSendMail=فشل إرسال البريد (ق = ٪ مرسل ، واستقبال = ٪)
 ErrorAttachedFilesDisabled=إرفاق ملفات الميزة المعوقين على هذا الخادم
 GoToWikiHelpPage=الانترنت تساعد على قراءة (على ضرورة الوصول إلى الإنترنت)
 CompanyFoundation=الشركة / المؤسسة
 FileTransferComplete=تم تحميل الملف بنجاح
-// STOP - Lines generated via autotranslator.php tool (2009-08-13 20:38:53).
-
-
-// START - Lines generated via autotranslator.php tool (2009-08-19 21:04:44).
-// Reference language: en_US
 Paid=دفع
 // STOP - Lines generated via autotranslator.php tool (2009-08-19 21:04:44).
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index a05f7640608..aa56dc4b16c 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -2389,7 +2389,8 @@ function price($amount, $html=0, $outlangs='', $trunc=1, $rounding=-1)
 
 	if ($outlangs->trans("SeparatorDecimal") != "SeparatorDecimal")  $dec=$outlangs->trans("SeparatorDecimal");
 	if ($outlangs->trans("SeparatorThousand")!= "SeparatorThousand") $thousand=$outlangs->trans("SeparatorThousand");
-	//print "amount=".$amount." html=".$html." trunc=".$trunc." nbdecimal=".$nbdecimal." dec=".$dec." thousand=".$thousand;
+	if ($thousand == 'None') $thousand='';
+	//print "amount=".$amount." html=".$html." trunc=".$trunc." nbdecimal=".$nbdecimal." dec='".$dec."' thousand='".$thousand."'<br>";
 
 	//print "amount=".$amount."-";
 	$amount = str_replace(',','.',$amount);	// should be useless
@@ -2450,6 +2451,8 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
 	$dec=','; $thousand=' ';
 	if ($langs->trans("SeparatorDecimal") != "SeparatorDecimal")  $dec=$langs->trans("SeparatorDecimal");
 	if ($langs->trans("SeparatorThousand")!= "SeparatorThousand") $thousand=$langs->trans("SeparatorThousand");
+	if ($thousand == 'None') $thousand='';
+	//print "amount=".$amount." html=".$html." trunc=".$trunc." nbdecimal=".$nbdecimal." dec='".$dec."' thousand='".$thousand."'<br>";
 
 	// Convert value to universal number format (no thousand separator, '.' as decimal separator)
 	if ($alreadysqlnb != 1)	// If not a PHP number or unknown, we change format
diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php
index eb6af0d4f97..f5a6561d2ec 100644
--- a/htdocs/translate.class.php
+++ b/htdocs/translate.class.php
@@ -305,7 +305,7 @@ class Translate {
 			if (empty($this->tab_loaded[$newdomain])) $this->tab_loaded[$newdomain]=2;           // Marque ce fichier comme non trouve
 		}
 
-		// Clear SeparatorDecimal, SeparatorThousand
+		// Check to be sure that SeparatorDecimal differs from SeparatorThousand
 		if (! empty($this->tab_translate["SeparatorDecimal"]) && ! empty($this->tab_translate["SeparatorThousand"])
 		&& $this->tab_translate["SeparatorDecimal"] == $this->tab_translate["SeparatorThousand"]) $this->tab_translate["SeparatorThousand"]='';
 
-- 
GitLab