Skip to content

Update intl.rst #12170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions components/intl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,10 @@ of officially recognized countries and territories::

\Locale::setDefault('en');

// Indexed with alpha-2
$countries = Countries::getNames();
// ('alpha2Code' => 'countryName')
// => ['AF' => 'Afghanistan', 'AX' => 'Åland Islands', ...]

// Indexed with alhpa-3
$countries = Countries::getAlpha3Names();
// ('alpha3Code' => 'countryName')
// => ['AFG' => 'Afghanistan', 'ALA' => 'Åland Islands', ...]
Expand All @@ -188,6 +186,10 @@ of officially recognized countries and territories::
$country = Countries::getAlpha3Name('NOR');
// => 'Norway'

.. versionadded:: 4.4

The support for alpha3 codes was introduced in Symfony 4.4.

All methods accept the translation locale as the last, optional parameter,
which defaults to the current default locale::

Expand All @@ -209,7 +211,7 @@ to catching the exception, you can also check if a given country code is valid::

$isValidCountry = Countries::exists($alpha2Code);

Or if you have a alpha3 country code you want to check:
Or if you have a alpha3 country code you want to check::

$isValidCountry = Countries::alpha3CodeExists($alpha3Code);

Expand Down