user724065
user724065

Reputation: 67

Yii2 - currency format euro

I have this in config:

        'formatter' => [
        'dateFormat' => 'yyyy-MM-dd',
        'decimalSeparator' => ',',
        'thousandSeparator' => '.',
        'currencyCode' => 'EUR',
   ], 

This print €20.000,00 but I want 20.000,00€ (with € in end).

Who I do this in yii2?

Upvotes: 2

Views: 1481

Answers (2)

ivan martinez
ivan martinez

Reputation: 196

The main source:

You should set this config:

Yii::$app->formatter->locale = 'et-EE';

With this is enough.

Upvotes: 2

soju
soju

Reputation: 25312

This simply means you need to enable PHP internationalization extension (aka intl) on your server : http://php.net/manual/en/book.intl.php

Read more about \yii\i18n\Formatter::asCurrency() :

This function does not require the PHP intl extension to be installed to work, but it is highly recommended to install it to get good formatting results.

Read more about PHP internationalization extension installation.

For example, to install it on Debian :

sudo apt-get install php5-intl

Don't forget to restart your web server after.

Upvotes: 1

Related Questions