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