mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-03 22:17:36 +00:00
Added details in the doc of filters and functions of IntlExtension
This commit is contained in:
committed by
Fabien Potencier
parent
8812664775
commit
8716392603
@@ -16,6 +16,13 @@ By default, the filter uses the current locale. You can pass it explicitly:
|
||||
{# États-Unis #}
|
||||
{{ 'US'|country_name('fr') }}
|
||||
|
||||
The locale can contain more than two letters depending on the region:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{# 美國 #}
|
||||
{{ 'US'|country_name('zh_Hant_HK') }}
|
||||
|
||||
.. note::
|
||||
|
||||
The ``country_name`` filter is part of the ``IntlExtension`` which is not
|
||||
@@ -41,4 +48,7 @@ By default, the filter uses the current locale. You can pass it explicitly:
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
@@ -1,7 +1,7 @@
|
||||
``currency_name``
|
||||
=================
|
||||
|
||||
The ``currency_name`` filter returns the currency name given its three-letter
|
||||
The ``currency_name`` filter returns the currency name given its ISO 4217 three-letter
|
||||
code:
|
||||
|
||||
.. code-block:: twig
|
||||
@@ -44,4 +44,7 @@ By default, the filter uses the current locale. You can pass it explicitly:
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
``currency_symbol``
|
||||
===================
|
||||
|
||||
The ``currency_symbol`` filter returns the currency symbol given its three-letter
|
||||
The ``currency_symbol`` filter returns the currency symbol given its ISO 4217 three-letter
|
||||
code:
|
||||
|
||||
.. code-block:: twig
|
||||
@@ -44,4 +44,7 @@ By default, the filter uses the current locale. You can pass it explicitly:
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
|
||||
@@ -74,4 +74,7 @@ Arguments
|
||||
|
||||
* ``currency``: The currency
|
||||
* ``attrs``: A map of attributes
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
|
||||
@@ -29,8 +29,11 @@ the :doc:`format_datetime<format_datetime>` filter, but without the time.
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
* ``dateFormat``: The date format
|
||||
* ``pattern``: A date time pattern
|
||||
* ``timezone``: The date timezone
|
||||
* ``calendar``: The calendar ("gregorian" by default)
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
@@ -98,7 +98,7 @@ The default timezone can also be set globally by calling ``setTimezone()``::
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
* ``dateFormat``: The date format
|
||||
* ``timeFormat``: The time format
|
||||
* ``pattern``: A date time pattern
|
||||
@@ -106,3 +106,5 @@ Arguments
|
||||
* ``calendar``: The calendar ("gregorian" by default)
|
||||
|
||||
.. _ICU user guide: https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
@@ -112,6 +112,9 @@ By default, the filter uses the current locale. You can pass it explicitly:
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
* ``attrs``: A map of attributes
|
||||
* ``style``: The style of the number output
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
@@ -29,8 +29,11 @@ the :doc:`format_datetime<format_datetime>` filter, but without the date.
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
* ``timeFormat``: The time format
|
||||
* ``pattern``: A date time pattern
|
||||
* ``timezone``: The date timezone
|
||||
* ``calendar``: The calendar ("gregorian" by default)
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
@@ -1,8 +1,8 @@
|
||||
``language_name``
|
||||
=================
|
||||
|
||||
The ``language_name`` filter returns the language name given its two-letter
|
||||
code:
|
||||
The ``language_name`` filter returns the language name based on its two-letter code (ISO 639-1),
|
||||
three-letter code (ISO 639-2) or other specific localized code:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
@@ -44,4 +44,7 @@ By default, the filter uses the current locale. You can pass it explicitly:
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
``locale_name``
|
||||
===============
|
||||
|
||||
The ``locale_name`` filter returns the locale name given its two-letter
|
||||
code:
|
||||
The ``locale_name`` filter returns the locale name given its code:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
@@ -44,4 +43,7 @@ By default, the filter uses the current locale. You can pass it explicitly:
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
|
||||
@@ -56,4 +56,7 @@ Arguments
|
||||
---------
|
||||
|
||||
* ``separator``: The separator that is used to join words (defaults to ``-``)
|
||||
* ``locale``: The locale of the original string (if none is specified, it will be automatically detected)
|
||||
* ``locale``: The locale code of the original string as defined in `RFC 5646`_ (if none is specified, it will be automatically detected). They are also documented in the `PHP Locale class`_.
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
@@ -1,7 +1,7 @@
|
||||
``timezone_name``
|
||||
=================
|
||||
|
||||
The ``timezone_name`` filter returns the timezone name given a timezone identifier:
|
||||
The ``timezone_name`` filter returns the timezone name given its ISO 8601 timezone identifier:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
@@ -43,4 +43,7 @@ By default, the filter uses the current locale. You can pass it explicitly:
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
|
||||
@@ -44,4 +44,7 @@ By default, the function uses the current locale. You can pass it explicitly:
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
=====================
|
||||
|
||||
The ``country_timezones`` function returns the names of the timezones associated
|
||||
with a given country code:
|
||||
with a given country its ISO-3166 code:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{# Europe/Paris #}
|
||||
{{ country_timezones('FR')|join(', ') }}
|
||||
|
||||
If the specified country were to be unknown, it will return an empty array
|
||||
|
||||
.. note::
|
||||
|
||||
The ``country_timezones`` function is part of the ``IntlExtension`` which is not
|
||||
@@ -30,3 +32,8 @@ with a given country code:
|
||||
|
||||
$twig = new \Twig\Environment(...);
|
||||
$twig->addExtension(new IntlExtension());
|
||||
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``country``: The country code
|
||||
@@ -44,4 +44,7 @@ By default, the function uses the current locale. You can pass it explicitly:
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
|
||||
@@ -44,4 +44,7 @@ By default, the function uses the current locale. You can pass it explicitly:
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
|
||||
@@ -44,4 +44,7 @@ By default, the function uses the current locale. You can pass it explicitly:
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
|
||||
@@ -44,4 +44,7 @@ By default, the function uses the current locale. You can pass it explicitly:
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
|
||||
@@ -44,4 +44,7 @@ By default, the function uses the current locale. You can pass it explicitly:
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``locale``: The locale
|
||||
* ``locale``: The locale code as defined in `RFC 5646`_. They are also documented in the `PHP Locale class`_.
|
||||
|
||||
.. _`RFC 5646`: https://www.rfc-editor.org/info/rfc5646
|
||||
.. _`PHP Locale class`: https://www.php.net/manual/en/class.locale.php
|
||||
|
||||
Reference in New Issue
Block a user