@@ -77,47 +77,42 @@ according to the `ISO 639-1 alpha-2`_ list and the `ISO 639-2 alpha-3`_ list::
77
77
// ('languageCode' => 'languageName')
78
78
// => ['ab' => 'Abkhazian', 'ace' => 'Achinese', ...]
79
79
80
- $language = Languages::getName('fr');
81
- // => 'French'
82
-
83
- You can also use the ISO 639-2 three-letter language codes instead of
84
- the ISO 639-1 two-letter codes, respectively called alpha3 and alpha2 codes::
85
-
86
- use Symfony\Component\Intl\Languages;
87
-
88
- \Locale::setDefault('en');
89
-
90
80
$languages = Languages::getAlpha3Names();
91
81
// ('languageCode' => 'languageName')
92
82
// => ['abk' => 'Abkhazian', 'ace' => 'Achinese', ...]
93
83
94
- $language = Languages::getAlpha3Name('fra ');
84
+ $language = Languages::getName('fr ');
95
85
// => 'French'
96
86
97
- .. versionadded :: 4.4
98
-
99
- The support for alpha3 codes was introduced in Symfony 4.4.
87
+ $language = Languages::getAlpha3Name('fra');
88
+ // => 'French'
100
89
101
90
All methods accept the translation locale as the last, optional parameter,
102
91
which defaults to the current default locale::
103
92
104
93
$languages = Languages::getNames('de');
105
94
// => ['ab' => 'Abchasisch', 'ace' => 'Aceh', ...]
106
95
96
+ $languages = Languages::getAlpha3Names('de');
97
+ // => ['abk' => 'Abchasisch', 'ace' => 'Aceh', ...]
98
+
107
99
$language = Languages::getName('fr', 'de');
108
100
// => 'Französisch'
109
101
102
+ $language = Languages::getAlpha3Name('fra', 'de');
103
+ // => 'Französisch'
104
+
110
105
If the given locale doesn't exist, the methods trigger a
111
106
:class: `Symfony\\ Component\\ Intl\\ Exception\\ MissingResourceException `. In addition
112
107
to catching the exception, you can also check if a given language code is valid::
113
108
114
109
$isValidLanguage = Languages::exists($languageCode);
115
110
116
- Or if you have a three-letter language code you want to check::
111
+ Or if you have a alpha3 language code you want to check::
117
112
118
113
$isValidLanguage = Languages::alpha3CodeExists($alpha3Code);
119
114
120
- You may convert codes between two-letter ISO 639-1 ( alpha2) and three-letter ISO 639-2 ( alpha3) codes::
115
+ You may convert codes between two-letter alpha2 and three-letter alpha3 codes::
121
116
122
117
$alpha3Code = Languages::getAlpha3Code($alpha2Code);
123
118
@@ -179,10 +174,6 @@ of officially recognized countries and territories::
179
174
$country = Countries::getAlpha3Name('NOR');
180
175
// => 'Norway'
181
176
182
- .. versionadded :: 4.4
183
-
184
- The support for alpha3 codes was introduced in Symfony 4.4.
185
-
186
177
All methods accept the translation locale as the last, optional parameter,
187
178
which defaults to the current default locale::
188
179
0 commit comments