I want to convert Price:200$ in words like Price:Two Hundred$.
In twig like this {{ price }} but this is show Number.
Can any one know how it is possible show this price in word in Twig ?
The Intl filter provided by the official Twig's extensions repository can spellout numbers:
{{ 19.2|localizednumber('spellout') }}
{# Output: nineteen point two #}
For this filter to work, the PHP intl extension is needed and the twig/extensions package must be installed.
If you use Twig directly, register the extension like this:
$twig->addExtension(new Twig_Extensions_Extension_Intl());
If you use Symfony, register this service:
services:
Twig_Extensions_Extension_Intl:
class: Twig_Extensions_Extension_Intl
private: true
tags:
- { name: twig.extension }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With