1

I'm working on currency display for my website using NumberFormatter::formatCurrency.

I did a quick a dirty test to see if everything was fine, like this:

    $nf = new \NumberFormatter('es_ES', \NumberFormatter::CURRENCY);
    var_dump($nf->formatCurrency(3000.05, 'EUR'));
    $nf = new \NumberFormatter('de_DE', \NumberFormatter::CURRENCY);
    var_dump($nf->formatCurrency(3000.05, 'EUR'));
    $nf = new \NumberFormatter('en_US', \NumberFormatter::CURRENCY);
    var_dump($nf->formatCurrency(3000.05, 'EUR'));
    $nf = new \NumberFormatter('en_GB', \NumberFormatter::CURRENCY);
    var_dump($nf->formatCurrency(3000.05, 'EUR'));
    $nf = new \NumberFormatter('fr_FR', \NumberFormatter::CURRENCY);
    var_dump($nf->formatCurrency(3000.05, 'EUR'));

And the result was

string(14) "3 000,05 €"
string(13) "3.000,05 €"
string(11) "€3,000.05"
string(11) "€3,000.05"
string(14) "3 000,05 €"

So everything looks fine except for the es_ES locale, because in Spain we use the same format than in Germany: X.XXX,XX €

If I run the command locale -a on my machine I get

C
C.UTF-8
en_GB.utf8
en_US.utf8
es_ES.utf8
POSIX

So, where's the problem? Are the locale definitions wrong on the es_ES case?

AntonioHS
  • 1,360
  • 10
  • 25

0 Answers0