Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3811393

Browse files
committed
minor #12175 Update intl.rst (ro0NL)
This PR was merged into the 4.4 branch. Discussion ---------- Update intl.rst follow up of #12173 (cc @OskarStark) Commits ------- b9ac17b Update intl.rst
2 parents 4ae7a7d + b9ac17b commit 3811393

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

components/intl.rst

Lines changed: 19 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

@@ -127,6 +122,10 @@ You may convert codes between two-letter ISO 639-1 (alpha2) and three-letter ISO
127122

128123
The ``Languages`` class was introduced in Symfony 4.3.
129124

125+
.. versionadded:: 4.4
126+
127+
The full support for alpha3 codes was introduced in Symfony 4.4.
128+
130129
The ``Scripts`` class provides access to the optional four-letter script code
131130
that can follow the language code according to the `Unicode ISO 15924 Registry`_
132131
(e.g. ``HANS`` in ``zh_HANS`` for simplified Chinese and ``HANT`` in ``zh_HANT``
@@ -187,10 +186,6 @@ of officially recognized countries and territories::
187186
$country = Countries::getAlpha3Name('NOR');
188187
// => 'Norway'
189188

190-
.. versionadded:: 4.4
191-
192-
The support for alpha3 codes was introduced in Symfony 4.4.
193-
194189
All methods accept the translation locale as the last, optional parameter,
195190
which defaults to the current default locale::
196191

@@ -226,6 +221,10 @@ You may convert codes between two-letter alpha2 and three-letter alpha3 codes::
226221

227222
The ``Countries`` class was introduced in Symfony 4.3.
228223

224+
.. versionadded:: 4.4
225+
226+
The support for alpha3 codes was introduced in Symfony 4.4.
227+
229228
Locales
230229
~~~~~~~
231230

0 commit comments

Comments
 (0)