开发者

How can I get the list of metazones from Zend Framework's Zend_Locale?

开发者 https://www.devze.com 2023-01-19 08:20 出处:网络
I\'m trying to have a list of all the most common time zones for a UI component. By digging in the Zend framework I found that supplementalData.xml (used by the Zend_Locale component) has a list of me

I'm trying to have a list of all the most common time zones for a UI component. By digging in the Zend framework I found that supplementalData.xml (used by the Zend_Locale component) has a list of metazones, with prefered TZ database time zone names

    <mapTimezones type="metazones">
        <mapZone other="Acre" territory="001" type="America/Rio_Branco"/>
        <mapZone other="Afghanistan" territory="001" type="Asia/Kabul"/>
        <mapZone other="Africa_Central" territory="001" type="Africa/Maputo"/>
        <mapZone other="Africa_Central" territory="BI" type="Africa/Bujumbura"/>
        <mapZone other="Africa_Central" territory="BW" type="Africa/Gaborone"/>
        <mapZone other="Africa_Central" territory="CD" type="Africa/Lubumbashi"/>
        (...)

I think that could be a nice fit for my needs and I'd like to have this list extracted. Rather than hacking my version of library I'd like to know if there is a way to get this list by normal means (there doesn't seem to be a way and this metazones info does not seem to be queried any开发者_如何学编程where).

Thanks!


I am not sure which one you are after, but your best candidate is

$locale->getTranslationList('TerritoryToTimezone');

where TerritoryToTimezone can be exchanged with any of identifiers described in the reference manual for Zend_Locale subchapter Obtaining Localized Data.

If none of these give you what you are looking for, you can still use DOM to parse the XML.


You can use timezone_abbreviations_list(), timezone_identifiers_list()... Last set of functions here

0

精彩评论

暂无评论...
验证码 换一张
取 消