Skip to content

Commit 4a717da

Browse files
Christian Schmidtc960657
Christian Schmidt
authored andcommitted
[Intl] Document timezone support
1 parent 1bb1a95 commit 4a717da

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

components/intl.rst

Lines 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+
$timezones = Intl::getTimezoneBundle()->getTimezoneNames();
348+
// => array('Africa/Abidjan' => 'Abidjan', ...)
349+
350+
$timezone = Intl::getTimezoneBundle()->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+
$timezones = Intl::getTimezoneBundle()->getTimezoneNames('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)