8000 Tweaks. refs #12105 · symfony/symfony-docs@b3d776d · GitHub
[go: up one dir, main page]

Skip to content

Commit b3d776d

Browse files
committed
Tweaks. refs #12105
1 parent 31425d7 commit b3d776d

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

components/intl.rst

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ The ``Languages`` class provides access to the name of all languages::
7979
$language = Languages::getName('fr');
8080
// => 'French'
8181

82-
If you want to you can also use the ISO 639-2 three-letter language codes instead of
83-
the ISO 639-1 two-letter codes. (They are here called alpha3 codes.)
82+
You can also use the ISO 639-2 three-letter language codes instead of
83+
the ISO 639-1 two-letter codes, respectively called alpha3 and alpha2 codes::
8484

8585
use Symfony\Component\Intl\Languages;
8686

@@ -93,6 +93,10 @@ the ISO 639-1 two-letter codes. (They are here called alpha3 codes.)
9393
$language = Languages::getAlpha3Name('fra');
9494
// => 'French'
9595

96+
.. versionadded:: 4.4
97+
98+
The support for alpha3 codes was introduced in Symfony 4.4.
99+
96100
All methods accept the translation locale as the last, optional parameter,
97101
which defaults to the current default locale::
98102

@@ -108,11 +112,11 @@ to catching the exception, you can also check if a given language code is valid:
108112

109113
$isValidLanguage = Languages::exists($languageCode);
110114

111-
Or if you have a three-letter language code you want to check:
115+
Or if you have a three-letter language code you want to check::
112116

113117
$isValidLanguage = Languages::alpha3CodeExists($alpha3Code);
114118

115-
You may convert codes between two-letter ISO 639-1 (alpha2) and three-letter ISO 639-2 (alpha3) codes:
119+
You may convert codes between two-letter ISO 639-1 (alpha2) and three-letter ISO 639-2 (alpha3) codes::
116120

117121
$alpha3Code = Languages::getAlpha3Code($alpha2Code);
118122

@@ -170,12 +174,12 @@ of officially recognized countries and territories::
170174

171175
// Indexed with alpha-2
172176
$countries = Countries::getNames();
173-
// ('countryCode' => 'countryName')
177+
// ('alpha2Code' => 'countryName')
174178
// => ['AF' => 'Afghanistan', 'AX' => 'Åland Islands', ...]
175179

176180
// Indexed with alhpa-3
177181
$countries = Countries::getAlpha3Names();
178-
// ('countryCode' => 'countryName')
182+
// ('alpha3Code' => 'countryName')
179183
// => ['AFG' => 'Afghanistan', 'ALA' => 'Åland Islands', ...]
180184

181185
$country = Countries::getName('GB');
@@ -196,7 +200,7 @@ which defaults to the current default locale::
196200
$country = Countries::getName('GB', 'de');
197201
// => 'Vereinigtes Königreich'
198202

199-
$country = Countries::getName('GBR', 'de');
203+
$country = Countries::getAlpha3Name('GBR', 'de');
200204
// => 'Vereinigtes Königreich'
201205

202206
If the given country code doesn't exist, the methods trigger a
@@ -205,9 +209,11 @@ to catching the exception, you can also check if a given country code is valid::
205209

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

208-
$isValidCountry = Countries::alpha3CodeExists($alpha2Code);
212+
Or if you have a alpha3 country code you want to check:
213+
214+
$isValidCountry = Countries::alpha3CodeExists($alpha3Code);
209215

210-
You may convert codes between two-letter alpha2 and three-letter alpha3 codes:
216+
You may convert codes between two-letter alpha2 and three-letter alpha3 codes::
211217

212218
$alpha3Code = Countries::getAlpha3Code($alpha2Code);
213219

0 commit comments

Comments
 (0)
0