Skip to content

[Intl] Mention that all methods trigger exceptions #11834

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2019
Merged
Changes from all 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
24 changes: 18 additions & 6 deletions components/intl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ which defaults to the current default locale::
$language = Languages::getName('fr', 'de');
// => 'Französisch'

You can also check if a given language code is valid::
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);

Expand Down Expand Up @@ -121,7 +123,9 @@ which defaults to the current default locale::
$language = Scripts::getName('Hans', 'de');
// => 'Vereinfacht'

You can also check if a given script code is valid::
If the given script code 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 script code is valid::

$isValidScript = Scripts::exists($scriptCode);

Expand Down Expand Up @@ -156,7 +160,9 @@ which defaults to the current default locale::
$country = Countries::getName('GB', 'de');
// => 'Vereinigtes Königreich'

You can also check if a given country code is valid::
If the given country code 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 country code is valid::

$isValidCountry = Countries::exists($countryCode);

Expand Down Expand Up @@ -192,7 +198,9 @@ which defaults to the current default locale::
$locale = Locales::getName('zh_Hans_MO', 'de');
// => 'Chinesisch (Vereinfacht, Sonderverwaltungsregion Macau)'

You can also check if a given locale code is valid::
If the given locale code 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 locale code is valid::

$isValidLocale = Locales::exists($localeCode);

Expand Down Expand Up @@ -236,7 +244,9 @@ the current default locale::
$currency = Currencies::getName('INR', 'de');
// => 'Indische Rupie'

You can also check if a given currency code is valid::
If the given currency code 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 currency code is valid::

$isValidCurrency = Currencies::exists($currencyCode);

Expand Down Expand Up @@ -314,7 +324,9 @@ you can pass the locale as the third optional argument::
$offset = Timezones::getGmtOffset('Europe/Madrid', strtotime('October 28, 2019'), 'ar')); // $offset = 'غرينتش+01:00'
$offset = Timezones::getGmtOffset('Europe/Madrid', strtotime('October 28, 2019'), 'dz')); // $offset = 'ཇི་ཨེམ་ཏི་+01:00'

Finally, you can also check if a given timezone ID is valid::
If the given timezone ID 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 timezone ID is valid::

$isValidTimezone = Timezones::exists($timezoneId);

Expand Down