1

I have a Craft/Commerce set up with Euro is base (and only) currency and 3 locales are defined in the site (nl_be, fr_be and en_be).

Prices are showing up as:

0,99 €

instead of

€0,99

When I print the entry's locale I get nl_be and my preferred language in the CP is also set to nl_be.

The url I'm using is also localised, through /nl/index.php, which sets CRAFT_LOCALE to nl_be.

I'm a bit clueless as to what I'm missing, any help would be appreciated.

Thanks!

1

Yii 1 gets its localization data from the Unicode Common Locale Data Repository. You can see that info in craft/app/vendor/yiisoft/yii/framework/i18n/data/nl_be.php where currencyFormat is defined as 'currencyFormat' => '#,##0.00 ¤'.

¤ is the placeholder for the locale's currency symbol, which puts it after the digits, which explains the behavior you're seeing.

If you want to continue to use that specific locale, you could do a |replace everywhere you output a currency. Or you could core hack that locale file to alter it and just make a note to check it after updating. Those locale files do get updated, but it's pretty rarely. Or you could switch to nl.php which appears to have the currency symbol first.

| improve this answer | |
  • Thanks Brad! Ended up changing the locale file in order to avoid having to do the replace everywhere. – Jan Henckens Oct 2 '17 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.