1``locale_name`` 2=============== 3 4.. versionadded:: 2.12 5 6 The ``locale_name`` filter was added in Twig 2.12. 7 8The ``locale_name`` filter returns the locale name given its two-letter 9code: 10 11.. code-block:: twig 12 13 {# German #} 14 {{ 'de'|locale_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'|locale_name('fr') }} 22 23 {# français (Canada) #} 24 {{ 'fr_CA'|locale_name('fr_FR') }} 25 26.. note:: 27 28 The ``locale_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