David Morales
David Morales

Reputation: 18064

format_currency and symbol position

I'm trying to display a spanish price. Spanish prices have the currency symbol AFTER the number, but Symfony insists in placing it before...

Is there any way to move it after the number?

Thanks!

Upvotes: 1

Views: 2283

Answers (3)

Mariano Del Rosso
Mariano Del Rosso

Reputation: 11

The ICU/CLDR that is used by symfony to determine the position of the currency symbol is wrong for the es_ES culture.

You need to patch the /lib/vend/symfony/i18n/data/es.dat file

Search for this string

s:12:"¤ #,##0.00"

and change it for this other

s:12:"#,##0.00 ¤"

Upvotes: 1

David Morales
David Morales

Reputation: 18064

It seems to be a bug. It will be solved probably in the next version.

Upvotes: 0

Raise
Raise

Reputation: 2034

You need to pass the format_currency function the culture parameter:

<?php echo format_currency('30.00', '€', 'es_ES'); ?>

will produce:

30.00€

Here, 'es_ES' is your country and language combination. If you are unfamiliar with this then read up on symfony and cultures.

Upvotes: 1

Related Questions