Remove product literal strings in "pht()", part 21
[phabricator.git] / resources / timezones / generate-timezone-map.php
blob77ee76c52b9fc2ee5dcd21ae16e01aa823047327
1 #!/usr/bin/env php
2 <?php
4 $root = dirname(dirname(dirname(__FILE__)));
5 require_once $root.'/scripts/init/init-script.php';
7 $xml = $root.'/externals/cldr/cldr_windows_timezones.xml';
8 $xml = Filesystem::readFile($xml);
9 $xml = new SimpleXMLElement($xml);
11 $result_map = array();
13 $ignore = array(
14 'UTC',
15 'UTC-11',
16 'UTC-02',
17 'UTC-08',
18 'UTC-09',
19 'UTC+12',
21 $ignore = array_fuse($ignore);
23 $zones = $xml->windowsZones->mapTimezones->mapZone;
24 foreach ($zones as $zone) {
25 $windows_name = (string)$zone['other'];
26 $target_name = (string)$zone['type'];
28 // Ignore the offset-based timezones from the CLDR map, since we handle
29 // these later.
30 if (isset($ignore[$windows_name])) {
31 continue;
34 // We've already seen this timezone so we don't need to add it to the map
35 // again.
36 if (isset($result_map[$windows_name])) {
37 continue;
40 $result_map[$windows_name] = $target_name;
43 asort($result_map);
45 echo id(new PhutilJSON())
46 ->encodeFormatted($result_map);