Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update intl.rst#12175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
OskarStark merged 1 commit intosymfony:4.4fromro0NL:patch-1
Aug 15, 2019
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 19 additions & 20 deletionscomponents/intl.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -77,47 +77,42 @@ according to the `ISO 639-1 alpha-2`_ list and the `ISO 639-2 alpha-3`_ list::
// ('languageCode' => 'languageName')
// => ['ab' => 'Abkhazian', 'ace' => 'Achinese', ...]

$language = Languages::getName('fr');
// => 'French'

You can also use the ISO 639-2 three-letter language codes instead of
the ISO 639-1 two-letter codes, respectively called alpha3 and alpha2 codes::

use Symfony\Component\Intl\Languages;

\Locale::setDefault('en');

$languages = Languages::getAlpha3Names();
// ('languageCode' => 'languageName')
// => ['abk' => 'Abkhazian', 'ace' => 'Achinese', ...]

$language = Languages::getAlpha3Name('fra');
$language = Languages::getName('fr');
// => 'French'

.. versionadded:: 4.4

The support for alpha3 codes was introduced in Symfony 4.4.
$language = Languages::getAlpha3Name('fra');
// => 'French'

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

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

$languages = Languages::getAlpha3Names('de');
// => ['abk' => 'Abchasisch', 'ace' => 'Aceh', ...]

$language = Languages::getName('fr', 'de');
// => 'Französisch'

$language = Languages::getAlpha3Name('fra', 'de');
// => 'Französisch'

If the given locale doesn't exist, the methods trigger a
:class:`Symfony\\Component\\Intl\\Exception\\MissingResourceException`. In addition
to catching the exception, you can also check if a given language code is valid::

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

Or if you have athree-letter language code you want to check::
Or if you have aalpha3 language code you want to check::

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

You may convert codes between two-letterISO 639-1 (alpha2) and three-letterISO 639-2 (alpha3) codes::
You may convert codes between two-letter alpha2 and three-letter alpha3 codes::

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

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

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

.. versionadded:: 4.4

The full support for alpha3 codes was introduced in Symfony 4.4.

The ``Scripts`` class provides access to the optional four-letter script code
that can follow the language code according to the `Unicode ISO 15924 Registry`_
(e.g. ``HANS`` in ``zh_HANS`` for simplified Chinese and ``HANT`` in ``zh_HANT``
Expand DownExpand Up@@ -187,10 +186,6 @@ of officially recognized countries and territories::
$country = Countries::getAlpha3Name('NOR');
// => 'Norway'

.. versionadded:: 4.4

The support for alpha3 codes was introduced in Symfony 4.4.

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

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

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

.. versionadded:: 4.4

The support for alpha3 codes was introduced in Symfony 4.4.

Locales
~~~~~~~

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp