1``country_name``
2================
3
4.. versionadded:: 2.12
5
6    The ``country_name`` filter was added in Twig 2.12.
7
8The ``country_name`` filter returns the country name given its ISO-3166
9two-letter code:
10
11.. code-block:: twig
12
13    {# France #}
14    {{ 'FR'|country_name }}
15
16By default, the filter uses the current locale. You can pass it explicitly:
17
18.. code-block:: twig
19
20    {# États-Unis #}
21    {{ 'US'|country_name('fr') }}
22
23.. note::
24
25    The ``country_name`` filter is part of the ``IntlExtension`` which is not
26    installed by default. Install it first:
27
28    .. code-block:: bash
29
30        $ composer require twig/intl-extra
31
32    Then, on Symfony projects, install the ``twig/extra-bundle``:
33
34    .. code-block:: bash
35
36        $ composer require twig/extra-bundle
37
38    Otherwise, add the extension explicitly on the Twig environment::
39
40        use Twig\Extra\Intl\IntlExtension;
41
42        $twig = new \Twig\Environment(...);
43        $twig->addExtension(new IntlExtension());
44
45Arguments
46---------
47
48* ``locale``: The locale
49