Gestion format nombre selon langue

This commit is contained in:
Laurent Destailleur 2006-08-27 22:10:47 +00:00
parent 8beec74bfb
commit 7d616a87f3
5 changed files with 24 additions and 5 deletions

View File

@ -1,5 +1,7 @@
# Dolibarr language file - en_US - main
charset=iso-8859-1
SeparatorDecimal=.
SeparatorThousand=,
Error=Error
ErrorFieldRequired=Field '%s' is required
ErrorFieldFormat=Field '%s' has a bad value

View File

@ -1,4 +1,7 @@
# Dolibarr language file - fr_BE - main
charset=iso-8859-1
SeparatorDecimal=,
SeparatorThousand=
Error=Erreur
ErrorFieldRequired=Le champ '%s' est obligatoire
ErrorFileDoesNotExists=Le fichier %s n'existe pas

View File

@ -1,5 +1,7 @@
# Dolibarr language file - fr_FR - main
charset=iso-8859-1
SeparatorDecimal=,
SeparatorThousand=
Error=Erreur
ErrorFieldRequired=Le champ '%s' est obligatoire
ErrorFieldFormat=Le champ '%s' a une valeur incorrecte

View File

@ -1,5 +1,7 @@
# Dolibarr language file - nl_BE - main
charset=iso-8859-1
SeparatorDecimal=,
SeparatorThousand=
Error=Fout
ErrorForbidden=Toegangs verboden
ErrorFileDoesNotExists=Bestand %s Bestaat Niet

View File

@ -1710,20 +1710,30 @@ function print_duree_select($prefix)
\remarks Fonction utilisée dans les pdf et les pages html
\param amount Montant a formater
\param html Formatage html ou pas (0 par defaut)
\param langs Objet langs
\seealso price2num Fonction inverse de price
*/
function price($amount, $html=0)
function price($amount, $html=0, $langs='')
{
// Separateurs par defaut
$dec='.'; $thousand=' ';
// Si $langs defini
if (is_object($langs))
{
if ($langs->trans("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->trans("SeparatorDecimal");
if ($langs->trans("SeparatorThousand")!= "SeparatorThousand") $thousand=$langs->trans("SeparatorThousand");
//print "x".$langs->trans("SeparatorThousand")."x";
}
// Formate nombre
if ($html)
{
$dec='.'; $thousand=' ';
return ereg_replace(' ',' ',number_format($amount, 2, $dec, $thousand));
}
else
{
return number_format($amount, 2, '.', ' ');
return number_format($amount, 2, $dec, $thousand);
}
}