Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame^] | 1 | ``country_timezones`` |
| 2 | ===================== |
| 3 | |
| 4 | The ``country_timezones`` function returns the names of the timezones associated |
| 5 | with a given country code: |
| 6 | |
| 7 | .. code-block:: twig |
| 8 | |
| 9 | {# Europe/Paris #} |
| 10 | {{ country_timezones('FR')|join(', ') }} |
| 11 | |
| 12 | .. note:: |
| 13 | |
| 14 | The ``country_timezones`` function is part of the ``IntlExtension`` which is not |
| 15 | installed by default. Install it first: |
| 16 | |
| 17 | .. code-block:: bash |
| 18 | |
| 19 | $ composer require twig/intl-extra |
| 20 | |
| 21 | Then, on Symfony projects, install the ``twig/extra-bundle``: |
| 22 | |
| 23 | .. code-block:: bash |
| 24 | |
| 25 | $ composer require twig/extra-bundle |
| 26 | |
| 27 | Otherwise, add the extension explicitly on the Twig environment:: |
| 28 | |
| 29 | use Twig\Extra\Intl\IntlExtension; |
| 30 | |
| 31 | $twig = new \Twig\Environment(...); |
| 32 | $twig->addExtension(new IntlExtension()); |