Skip to content

Commit 1132596

Browse files
committed
Merge branch '4.4'
* 4.4: Update intl.rst
2 parents c5cef1d + 3811393 commit 1132596

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

components/intl.rst

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -77,47 +77,42 @@ according to the `ISO 639-1 alpha-2`_ list and the `ISO 639-2 alpha-3`_ list::
7777
// ('languageCode' => 'languageName')
7878
// => ['ab' => 'Abkhazian', 'ace' => 'Achinese', ...]
7979

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-
9080
$languages = Languages::getAlpha3Names();
9181
// ('languageCode' => 'languageName')
9282
// => ['abk' => 'Abkhazian', 'ace' => 'Achinese', ...]
9383

94-
$language = Languages::getAlpha3Name('fra');
84+
$language = Languages::getName('fr');
9585
// => 'French'
9686

97-
.. versionadded:: 4.4
98-
99-
The support for alpha3 codes was introduced in Symfony 4.4.
87+
$language = Languages::getAlpha3Name('fra');
88+
// => 'French'
10089

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

10493
$languages = Languages::getNames('de');
10594
// => ['ab' => 'Abchasisch', 'ace' => 'Aceh', ...]
10695

96+
$languages = Languages::getAlpha3Names('de');
97+
// => ['abk' => 'Abchasisch', 'ace' => 'Aceh', ...]
98+
10799
$language = Languages::getName('fr', 'de');
108100
// => 'Französisch'
109101

102+
$language = Languages::getAlpha3Name('fra', 'de');
103+
// => 'Französisch'
104+
110105
If the given locale doesn't exist, the methods trigger a
111106
:class:`Symfony\\Component\\Intl\\Exception\\MissingResourceException`. In addition
112107
to catching the exception, you can also check if a given language code is valid::
113108

114109
$isValidLanguage = Languages::exists($languageCode);
115110

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::
117112

118113
$isValidLanguage = Languages::alpha3CodeExists($alpha3Code);
119114

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::
121116

122117
$alpha3Code = Languages::getAlpha3Code($alpha2Code);
123118

@@ -179,10 +174,6 @@ of officially recognized countries and territories::
179174
$country = Countries::getAlpha3Name('NOR');
180175
// => 'Norway'
181176

182-
.. versionadded:: 4.4
183-
184-
The support for alpha3 codes was introduced in Symfony 4.4.
185-
186177
All methods accept the translation locale as the last, optional parameter,
187178
which defaults to the current default locale::
188179

0 commit comments

Comments
 (0)