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

Appearance settings

Commit 3f2f459

Browse filesBrowse files
author
Christian Schmidt
committed
[Intl] Document timezone support
1 parent 1bb1a95 commit 3f2f459
Copy full SHA for 3f2f459

File tree

1 file changed

+21
-0
lines changed
Filter options

1 file changed

+21
-0
lines changed

‎components/intl.rst

Copy file name to clipboardExpand all lines: components/intl.rst
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,27 @@ to the current default locale::
335335
$currencies = Intl::getCurrencyBundle()->getCurrencyNames('de');
336336
// => array('AFN' => 'Afghanische Afghani', ...)
337337

338+
Timezones
339+
~~~~~~~
340+
341+
The translations of timezone names can be found in the timezone bundle::
342+
343+
use Symfony\Component\Intl\Intl;
344+
345+
\Locale::setDefault('en');
346+
347+
$locales = Intl::getTimezoneBundle()->getTimezoneNames();
348+
// => array('Africa/Abidjan' => 'Abidjan', ...)
349+
350+
$locale = Intl::getLocaleBundle()->getTimezoneName('America/St_Barthelemy');
351+
// => 'St. Barthélemy'
352+
353+
All methods accept the translation locale as the last, optional parameter,
354+
which defaults to the current default locale::
355+
356+
$locales = Intl::getLocaleBundle()->getLocaleNames('de');
357+
// => array('Africa/Abidjan' => 'Abidjan', ...)
358+
338359
That's all you need to know for now. Have fun coding!
339360

340361
.. _Packagist: https://packagist.org/packages/symfony/intl

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.