blob: a35c499988d9202225eb36e2e9a32fce8f380bf6 [file] [log] [blame]
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +01001``currency_name``
2=================
3
4The ``currency_name`` filter returns the currency name given its three-letter
5code:
6
7.. code-block:: twig
8
9 {# Euro #}
10 {{ 'EUR'|currency_name }}
11
12 {# Japanese Yen #}
13 {{ 'JPY'|currency_name }}
14
15By default, the filter uses the current locale. You can pass it explicitly:
16
17.. code-block:: twig
18
19 {# yen japonais #}
20 {{ 'JPY'|currency_name('fr_FR') }}
21
22.. note::
23
24 The ``currency_name`` filter is part of the ``IntlExtension`` which is not
25 installed by default. Install it first:
26
27 .. code-block:: bash
28
29 $ composer require twig/intl-extra
30
31 Then, on Symfony projects, install the ``twig/extra-bundle``:
32
33 .. code-block:: bash
34
35 $ composer require twig/extra-bundle
36
37 Otherwise, add the extension explicitly on the Twig environment::
38
39 use Twig\Extra\Intl\IntlExtension;
40
41 $twig = new \Twig\Environment(...);
42 $twig->addExtension(new IntlExtension());
43
44Arguments
45---------
46
47* ``locale``: The locale