diff --git a/doc/filters/country_name.rst b/doc/filters/country_name.rst index 434b0bda7..394e9f5b7 100644 --- a/doc/filters/country_name.rst +++ b/doc/filters/country_name.rst @@ -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 \ No newline at end of file diff --git a/doc/filters/currency_name.rst b/doc/filters/currency_name.rst index a35c49998..9c8aba2a2 100644 --- a/doc/filters/currency_name.rst +++ b/doc/filters/currency_name.rst @@ -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 diff --git a/doc/filters/currency_symbol.rst b/doc/filters/currency_symbol.rst index 84a048ed5..716a7f310 100644 --- a/doc/filters/currency_symbol.rst +++ b/doc/filters/currency_symbol.rst @@ -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 diff --git a/doc/filters/format_currency.rst b/doc/filters/format_currency.rst index 8b649bf5d..6c140f951 100644 --- a/doc/filters/format_currency.rst +++ b/doc/filters/format_currency.rst @@ -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 diff --git a/doc/filters/format_date.rst b/doc/filters/format_date.rst index cd6beba9f..c36748ecc 100644 --- a/doc/filters/format_date.rst +++ b/doc/filters/format_date.rst @@ -29,8 +29,11 @@ the :doc:`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 \ No newline at end of file diff --git a/doc/filters/format_datetime.rst b/doc/filters/format_datetime.rst index 8f3b46d47..085af1294 100644 --- a/doc/filters/format_datetime.rst +++ b/doc/filters/format_datetime.rst @@ -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 \ No newline at end of file diff --git a/doc/filters/format_number.rst b/doc/filters/format_number.rst index a1c2804ab..301b10348 100644 --- a/doc/filters/format_number.rst +++ b/doc/filters/format_number.rst @@ -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 \ No newline at end of file diff --git a/doc/filters/format_time.rst b/doc/filters/format_time.rst index 1e213e616..25710e5ce 100644 --- a/doc/filters/format_time.rst +++ b/doc/filters/format_time.rst @@ -29,8 +29,11 @@ the :doc:`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 \ No newline at end of file diff --git a/doc/filters/language_name.rst b/doc/filters/language_name.rst index 55c243920..96295950e 100644 --- a/doc/filters/language_name.rst +++ b/doc/filters/language_name.rst @@ -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 diff --git a/doc/filters/locale_name.rst b/doc/filters/locale_name.rst index c6d34cbc0..dd835055c 100644 --- a/doc/filters/locale_name.rst +++ b/doc/filters/locale_name.rst @@ -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 diff --git a/doc/filters/slug.rst b/doc/filters/slug.rst index 773a42fac..57085f767 100644 --- a/doc/filters/slug.rst +++ b/doc/filters/slug.rst @@ -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 \ No newline at end of file diff --git a/doc/filters/timezone_name.rst b/doc/filters/timezone_name.rst index dfb22818b..1391ffe07 100644 --- a/doc/filters/timezone_name.rst +++ b/doc/filters/timezone_name.rst @@ -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 diff --git a/doc/functions/country_names.rst b/doc/functions/country_names.rst index 692137b04..fe03ba522 100644 --- a/doc/functions/country_names.rst +++ b/doc/functions/country_names.rst @@ -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 diff --git a/doc/functions/country_timezones.rst b/doc/functions/country_timezones.rst index ecbbc1c99..370a4beff 100644 --- a/doc/functions/country_timezones.rst +++ b/doc/functions/country_timezones.rst @@ -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 \ No newline at end of file diff --git a/doc/functions/currency_names.rst b/doc/functions/currency_names.rst index dfb446c86..8df215eb2 100644 --- a/doc/functions/currency_names.rst +++ b/doc/functions/currency_names.rst @@ -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 diff --git a/doc/functions/language_names.rst b/doc/functions/language_names.rst index f1cce488a..dd9b8930f 100644 --- a/doc/functions/language_names.rst +++ b/doc/functions/language_names.rst @@ -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 diff --git a/doc/functions/locale_names.rst b/doc/functions/locale_names.rst index 320ab6724..3a8b71fe4 100644 --- a/doc/functions/locale_names.rst +++ b/doc/functions/locale_names.rst @@ -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 diff --git a/doc/functions/script_names.rst b/doc/functions/script_names.rst index 79b20c65f..963526f66 100644 --- a/doc/functions/script_names.rst +++ b/doc/functions/script_names.rst @@ -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 diff --git a/doc/functions/timezone_names.rst b/doc/functions/timezone_names.rst index 69db196fd..5aa769910 100644 --- a/doc/functions/timezone_names.rst +++ b/doc/functions/timezone_names.rst @@ -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