@@ -79,8 +79,8 @@ The ``Languages`` class provides access to the name of all languages::
79
79
$language = Languages::getName('fr');
80
80
// => 'French'
81
81
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::
84
84
85
85
use Symfony\Component\Intl\Languages;
86
86
@@ -93,6 +93,10 @@ the ISO 639-1 two-letter codes. (They are here called alpha3 codes.)
93
93
$language = Languages::getAlpha3Name('fra');
94
94
// => 'French'
95
95
96
+ .. versionadded :: 4.4
97
+
98
+ The support for alpha3 codes was introduced in Symfony 4.4.
99
+
96
100
All methods accept the translation locale as the last, optional parameter,
97
101
which defaults to the current default locale::
98
102
@@ -108,11 +112,11 @@ to catching the exception, you can also check if a given language code is valid:
108
112
109
113
$isValidLanguage = Languages::exists($languageCode);
110
114
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::
112
116
113
117
$isValidLanguage = Languages::alpha3CodeExists($alpha3Code);
114
118
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::
116
120
117
121
$alpha3Code = Languages::getAlpha3Code($alpha2Code);
118
122
@@ -170,12 +174,12 @@ of officially recognized countries and territories::
170
174
171
175
// Indexed with alpha-2
172
176
$countries = Countries::getNames();
173
- // ('countryCode ' => 'countryName')
177
+ // ('alpha2Code ' => 'countryName')
174
178
// => ['AF' => 'Afghanistan', 'AX' => 'Åland Islands', ...]
175
179
176
180
// Indexed with alhpa-3
177
181
$countries = Countries::getAlpha3Names();
178
- // ('countryCode ' => 'countryName')
182
+ // ('alpha3Code ' => 'countryName')
179
183
// => ['AFG' => 'Afghanistan', 'ALA' => 'Åland Islands', ...]
180
184
181
185
$country = Countries::getName('GB');
@@ -196,7 +200,7 @@ which defaults to the current default locale::
196
200
$country = Countries::getName('GB', 'de');
197
201
// => 'Vereinigtes Königreich'
198
202
199
- $country = Countries::getName ('GBR', 'de');
203
+ $country = Countries::getAlpha3Name ('GBR', 'de');
200
204
// => 'Vereinigtes Königreich'
201
205
202
206
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::
205
209
206
210
$isValidCountry = Countries::exists($alpha2Code);
207
211
208
- $isValidCountry = Countries::alpha3CodeExists($alpha2Code);
212
+ Or if you have a alpha3 country code you want to check:
213
+
214
+ $isValidCountry = Countries::alpha3CodeExists($alpha3Code);
209
215
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::
211
217
212
218
$alpha3Code = Countries::getAlpha3Code($alpha2Code);
213
219
0 commit comments