Gestion format nombre selon langue
This commit is contained in:
parent
8beec74bfb
commit
7d616a87f3
@ -1,5 +1,7 @@
|
|||||||
# Dolibarr language file - en_US - main
|
# Dolibarr language file - en_US - main
|
||||||
charset=iso-8859-1
|
charset=iso-8859-1
|
||||||
|
SeparatorDecimal=.
|
||||||
|
SeparatorThousand=,
|
||||||
Error=Error
|
Error=Error
|
||||||
ErrorFieldRequired=Field '%s' is required
|
ErrorFieldRequired=Field '%s' is required
|
||||||
ErrorFieldFormat=Field '%s' has a bad value
|
ErrorFieldFormat=Field '%s' has a bad value
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
|
# Dolibarr language file - fr_BE - main
|
||||||
charset=iso-8859-1
|
charset=iso-8859-1
|
||||||
|
SeparatorDecimal=,
|
||||||
|
SeparatorThousand=
|
||||||
Error=Erreur
|
Error=Erreur
|
||||||
ErrorFieldRequired=Le champ '%s' est obligatoire
|
ErrorFieldRequired=Le champ '%s' est obligatoire
|
||||||
ErrorFileDoesNotExists=Le fichier %s n'existe pas
|
ErrorFileDoesNotExists=Le fichier %s n'existe pas
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
# Dolibarr language file - fr_FR - main
|
# Dolibarr language file - fr_FR - main
|
||||||
charset=iso-8859-1
|
charset=iso-8859-1
|
||||||
|
SeparatorDecimal=,
|
||||||
|
SeparatorThousand=
|
||||||
Error=Erreur
|
Error=Erreur
|
||||||
ErrorFieldRequired=Le champ '%s' est obligatoire
|
ErrorFieldRequired=Le champ '%s' est obligatoire
|
||||||
ErrorFieldFormat=Le champ '%s' a une valeur incorrecte
|
ErrorFieldFormat=Le champ '%s' a une valeur incorrecte
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
# Dolibarr language file - nl_BE - main
|
# Dolibarr language file - nl_BE - main
|
||||||
charset=iso-8859-1
|
charset=iso-8859-1
|
||||||
|
SeparatorDecimal=,
|
||||||
|
SeparatorThousand=
|
||||||
Error=Fout
|
Error=Fout
|
||||||
ErrorForbidden=Toegangs verboden
|
ErrorForbidden=Toegangs verboden
|
||||||
ErrorFileDoesNotExists=Bestand %s Bestaat Niet
|
ErrorFileDoesNotExists=Bestand %s Bestaat Niet
|
||||||
|
|||||||
@ -1710,20 +1710,30 @@ function print_duree_select($prefix)
|
|||||||
\remarks Fonction utilisée dans les pdf et les pages html
|
\remarks Fonction utilisée dans les pdf et les pages html
|
||||||
\param amount Montant a formater
|
\param amount Montant a formater
|
||||||
\param html Formatage html ou pas (0 par defaut)
|
\param html Formatage html ou pas (0 par defaut)
|
||||||
|
\param langs Objet langs
|
||||||
\seealso price2num Fonction inverse de price
|
\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)
|
if ($html)
|
||||||
{
|
{
|
||||||
|
|
||||||
$dec='.'; $thousand=' ';
|
|
||||||
return ereg_replace(' ',' ',number_format($amount, 2, $dec, $thousand));
|
return ereg_replace(' ',' ',number_format($amount, 2, $dec, $thousand));
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return number_format($amount, 2, '.', ' ');
|
return number_format($amount, 2, $dec, $thousand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user