yii2: Ability to set currency symbol in formatter do not working
What steps will reproduce the problem?
I’m configure my frontend/config/main.php:
'language' => 'ru-RU',
'components' => [
...
'formatter' => [
'dateFormat' => 'dd.MM.yyyy',
'decimalSeparator' => ',',
'thousandSeparator' => ' ',
'currencyCode' => 'RUB',
'numberFormatterOptions' => [
NumberFormatter::MIN_FRACTION_DIGITS => 0,
NumberFormatter::MAX_FRACTION_DIGITS => 2,
],
'numberFormatterSymbols' => [
NumberFormatter::CURRENCY_SYMBOL => '₽',
]
],
],
What is the expected result?
When i writting
<?= Yii::$app->formatter->asCurrency(100000) ?>
i expect to see 100 000 ₽ (my symbol)
What do you get instead?
but i get 100 000,00 руб.
Additional info
When i setting parameter numberFormatterSymbols, parameter numberFormatterOptions not working after (before result was 100 000 руб.)
| Q | A |
|---|---|
| Yii version | 2.0.11.2? |
| PHP version | 7.1.0 |
| Operating system | ubuntu/trusty64 |
| and i testing too on native vagrant settings of yii2 | same result |
thats my first issue, sry if something wrong
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (11 by maintainers)
Here’s what I’ve found so far:
Please, read XAMPP documentation.
https://www.yiiframework.com/wiki/100/yii-and-xampp-server-on-windows
Sorry, a little out of topic, but, I want to set my thousand (.) and decimal (,) separator in my currency (example: Rp 12.500,50). My formatter code:
The output is
Rp 12.500.50<- decimal is . I’m expectingRp 12.500,50<- decimal is ,What went wrong? Thanks.