From a9da7e05b4b1f06423791537346c0c33101c464d Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Tue, 25 Jul 2023 18:36:52 +0200 Subject: [PATCH] Document support for ISO 3166-1 numeric codes To accompany PR https://github.com/symfony/symfony/pull/51073 --- components/intl.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/components/intl.rst b/components/intl.rst index 5ec6c4b7011..7983efb5eeb 100644 --- a/components/intl.rst +++ b/components/intl.rst @@ -179,6 +179,33 @@ You may convert codes between two-letter alpha2 and three-letter alpha3 codes:: $alpha2Code = Countries::getAlpha2Code($alpha3Code); +Numeric Country Codes +~~~~~~~~~~~~~~~~~~~~~ + +The :class:`Symfony\\Component\\Intl\\Countries` class also provides access to the +numeric country codes according to the `ISO 3166-1 numeric`_ list:: + + use Symfony\Component\Intl\Countries; + + \Locale::setDefault('en'); + + $numericCodes = Countries::getNumericCodes(); + // ('alpha2Code' => 'numericCode') + // => ['AA' => '958', 'AD' => '020', ...] + + $numericCode = Countries::getNumericCode('FR'); + // => '250' + + $alpha2 = Countries::getAlpha2FromNumeric('250'); + // => 'FR' + + $exists = Countries::numericCodeExists('250'); + // => true + +.. versionadded:: 6.4 + + The support for numeric country codes was introduced in Symfony 6.4. + Locales ~~~~~~~ @@ -435,6 +462,7 @@ Learn more .. _`Unicode ISO 15924 Registry`: https://www.unicode.org/iso15924/iso15924-codes.html .. _`ISO 3166-1 alpha-2`: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 .. _`ISO 3166-1 alpha-3`: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3 +.. _`ISO 3166-1 numeric`: https://en.wikipedia.org/wiki/ISO_3166-1_numeric .. _`UTC/GMT time offsets`: https://en.wikipedia.org/wiki/List_of_UTC_time_offsets .. _`daylight saving time (DST)`: https://en.wikipedia.org/wiki/Daylight_saving_time .. _`ISO 639-1 alpha-2`: https://en.wikipedia.org/wiki/ISO_639-1 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy