Skip to content
Permalink
Browse files

minor #31434 [Intl] Revise timezone name generation (ro0NL)

This PR was merged into the 4.3 branch.

Discussion
----------

 [Intl] Revise timezone name generation

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes (inlcluding intl-data group)
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

This is the final polishing needed for #31294 :)

I've realized it's much easier to de-duplicate by processing fallback locales separate, and then only keep the diff compared to a specific locale. More or less the same approach `LocaleDataGenerator` already follows. I was trying to be clever and filter based on inheritance in a single process; bad idea.

Includes ro0NL@31591d0 (ref #31432)

Commits
-------

bfdb4ed [Intl] Revise timezone name generation
  • Loading branch information...
nicolas-grekas committed May 9, 2019
2 parents 76e884d + bfdb4ed commit cbbf8b7fd6a5e087ea61ff0b31cb6b5e1b57701d
Showing with 3,900 additions and 6,778 deletions.
  1. +111 −96 src/Symfony/Component/Intl/Data/Generator/TimezoneDataGenerator.php
  2. +9 −15 src/Symfony/Component/Intl/Resources/data/timezones/af.json
  3. +10 −12 src/Symfony/Component/Intl/Resources/data/timezones/am.json
  4. +9 −13 src/Symfony/Component/Intl/Resources/data/timezones/ar.json
  5. +12 −18 src/Symfony/Component/Intl/Resources/data/timezones/as.json
  6. +11 −17 src/Symfony/Component/Intl/Resources/data/timezones/az.json
  7. +13 −16 src/Symfony/Component/Intl/Resources/data/timezones/be.json
  8. +1 −5 src/Symfony/Component/Intl/Resources/data/timezones/bg.json
  9. +9 −13 src/Symfony/Component/Intl/Resources/data/timezones/bn.json
  10. +1 −13 src/Symfony/Component/Intl/Resources/data/timezones/bo.json
  11. +103 −112 src/Symfony/Component/Intl/Resources/data/timezones/br.json
  12. +1 −4 src/Symfony/Component/Intl/Resources/data/timezones/bs.json
  13. +8 −6 src/Symfony/Component/Intl/Resources/data/timezones/bs_Cyrl.json
  14. +9 −15 src/Symfony/Component/Intl/Resources/data/timezones/ca.json
  15. +1 −8 src/Symfony/Component/Intl/Resources/data/timezones/ce.json
  16. +8 −11 src/Symfony/Component/Intl/Resources/data/timezones/cs.json
  17. +11 −17 src/Symfony/Component/Intl/Resources/data/timezones/cy.json
  18. +2 −5 src/Symfony/Component/Intl/Resources/data/timezones/da.json
  19. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/de.json
  20. +85 −90 src/Symfony/Component/Intl/Resources/data/timezones/dz.json
  21. +12 −16 src/Symfony/Component/Intl/Resources/data/timezones/ee.json
  22. +9 −15 src/Symfony/Component/Intl/Resources/data/timezones/el.json
  23. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/en.json
  24. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/es.json
  25. +1 −1 src/Symfony/Component/Intl/Resources/data/timezones/es_MX.json
  26. +2 −2 src/Symfony/Component/Intl/Resources/data/timezones/es_US.json
  27. +7 −10 src/Symfony/Component/Intl/Resources/data/timezones/et.json
  28. +9 −15 src/Symfony/Component/Intl/Resources/data/timezones/eu.json
  29. +10 −12 src/Symfony/Component/Intl/Resources/data/timezones/fa.json
  30. +8 −10 src/Symfony/Component/Intl/Resources/data/timezones/fi.json
  31. +12 −18 src/Symfony/Component/Intl/Resources/data/timezones/fo.json
  32. +7 −10 src/Symfony/Component/Intl/Resources/data/timezones/fr.json
  33. +0 −1 src/Symfony/Component/Intl/Resources/data/timezones/fr_CA.json
  34. +12 −19 src/Symfony/Component/Intl/Resources/data/timezones/fy.json
  35. +1 −5 src/Symfony/Component/Intl/Resources/data/timezones/ga.json
  36. +1 −7 src/Symfony/Component/Intl/Resources/data/timezones/gd.json
  37. +9 −15 src/Symfony/Component/Intl/Resources/data/timezones/gl.json
  38. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/gu.json
  39. +216 −222 src/Symfony/Component/Intl/Resources/data/timezones/ha.json
  40. +10 −12 src/Symfony/Component/Intl/Resources/data/timezones/he.json
  41. +9 −15 src/Symfony/Component/Intl/Resources/data/timezones/hi.json
  42. +1 −5 src/Symfony/Component/Intl/Resources/data/timezones/hr.json
  43. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/hu.json
  44. +1 −7 src/Symfony/Component/Intl/Resources/data/timezones/hy.json
  45. +171 −177 src/Symfony/Component/Intl/Resources/data/timezones/ia.json
  46. +8 −11 src/Symfony/Component/Intl/Resources/data/timezones/id.json
  47. +58 −64 src/Symfony/Component/Intl/Resources/data/timezones/ig.json
  48. +1 −13 src/Symfony/Component/Intl/Resources/data/timezones/ii.json
  49. +0 −446 src/Symfony/Component/Intl/Resources/data/timezones/in.json
  50. +1 −7 src/Symfony/Component/Intl/Resources/data/timezones/is.json
  51. +9 −15 src/Symfony/Component/Intl/Resources/data/timezones/it.json
  52. +0 −446 src/Symfony/Component/Intl/Resources/data/timezones/iw.json
  53. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/ja.json
  54. +12 −18 src/Symfony/Component/Intl/Resources/data/timezones/jv.json
  55. +12 −18 src/Symfony/Component/Intl/Resources/data/timezones/ka.json
  56. +12 −18 src/Symfony/Component/Intl/Resources/data/timezones/kk.json
  57. +12 −16 src/Symfony/Component/Intl/Resources/data/timezones/km.json
  58. +9 −15 src/Symfony/Component/Intl/Resources/data/timezones/kn.json
  59. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/ko.json
  60. +1 −8 src/Symfony/Component/Intl/Resources/data/timezones/ks.json
  61. +12 −18 src/Symfony/Component/Intl/Resources/data/timezones/ky.json
  62. +8 −15 src/Symfony/Component/Intl/Resources/data/timezones/lb.json
  63. +409 −421 src/Symfony/Component/Intl/Resources/data/timezones/ln.json
  64. +10 −16 src/Symfony/Component/Intl/Resources/data/timezones/lo.json
  65. +7 −11 src/Symfony/Component/Intl/Resources/data/timezones/lt.json
  66. +9 −15 src/Symfony/Component/Intl/Resources/data/timezones/lv.json
  67. +1 −7 src/Symfony/Component/Intl/Resources/data/timezones/mi.json
  68. +8 −14 src/Symfony/Component/Intl/Resources/data/timezones/mk.json
  69. +7 −11 src/Symfony/Component/Intl/Resources/data/timezones/ml.json
  70. +12 −18 src/Symfony/Component/Intl/Resources/data/timezones/mn.json
  71. +0 −446 src/Symfony/Component/Intl/Resources/data/timezones/mo.json
  72. +7 −11 src/Symfony/Component/Intl/Resources/data/timezones/mr.json
  73. +9 −15 src/Symfony/Component/Intl/Resources/data/timezones/ms.json
  74. +393 −405 src/Symfony/Component/Intl/Resources/data/timezones/mt.json
  75. +12 −18 src/Symfony/Component/Intl/Resources/data/timezones/my.json
  76. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/nb.json
  77. +12 −18 src/Symfony/Component/Intl/Resources/data/timezones/ne.json
  78. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/nl.json
  79. +12 −18 src/Symfony/Component/Intl/Resources/data/timezones/nn.json
  80. +0 −446 src/Symfony/Component/Intl/Resources/data/timezones/no.json
  81. +1 −13 src/Symfony/Component/Intl/Resources/data/timezones/om.json
  82. +12 −18 src/Symfony/Component/Intl/Resources/data/timezones/or.json
  83. +71 −82 src/Symfony/Component/Intl/Resources/data/timezones/os.json
  84. +12 −18 src/Symfony/Component/Intl/Resources/data/timezones/pa.json
  85. +9 −15 src/Symfony/Component/Intl/Resources/data/timezones/pl.json
  86. +35 −41 src/Symfony/Component/Intl/Resources/data/timezones/ps.json
  87. +2 −0 src/Symfony/Component/Intl/Resources/data/timezones/ps_PK.json
  88. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/pt.json
  89. +6 −1 src/Symfony/Component/Intl/Resources/data/timezones/pt_PT.json
  90. +1 −13 src/Symfony/Component/Intl/Resources/data/timezones/qu.json
  91. +1 −13 src/Symfony/Component/Intl/Resources/data/timezones/rm.json
  92. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/ro.json
  93. +8 −0 src/Symfony/Component/Intl/Resources/data/timezones/root.json
  94. +1 −7 src/Symfony/Component/Intl/Resources/data/timezones/ru.json
  95. +1 −13 src/Symfony/Component/Intl/Resources/data/timezones/rw.json
  96. +12 −18 src/Symfony/Component/Intl/Resources/data/timezones/sd.json
  97. +332 −340 src/Symfony/Component/Intl/Resources/data/timezones/se.json
  98. +2 −29 src/Symfony/Component/Intl/Resources/data/timezones/se_FI.json
  99. +0 −446 src/Symfony/Component/Intl/Resources/data/timezones/sh.json
  100. +13 −15 src/Symfony/Component/Intl/Resources/data/timezones/si.json
  101. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/sk.json
  102. +10 −13 src/Symfony/Component/Intl/Resources/data/timezones/sl.json
  103. +12 −18 src/Symfony/Component/Intl/Resources/data/timezones/so.json
  104. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/sq.json
  105. +1 −7 src/Symfony/Component/Intl/Resources/data/timezones/sr.json
  106. +1 −0 src/Symfony/Component/Intl/Resources/data/timezones/sr_Latn.json
  107. +7 −11 src/Symfony/Component/Intl/Resources/data/timezones/sv.json
  108. +9 −13 src/Symfony/Component/Intl/Resources/data/timezones/sw.json
  109. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/ta.json
  110. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/te.json
  111. +1 −7 src/Symfony/Component/Intl/Resources/data/timezones/tg.json
  112. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/th.json
  113. +1 −13 src/Symfony/Component/Intl/Resources/data/timezones/ti.json
  114. +12 −18 src/Symfony/Component/Intl/Resources/data/timezones/tk.json
  115. +0 −446 src/Symfony/Component/Intl/Resources/data/timezones/tl.json
  116. +7 −14 src/Symfony/Component/Intl/Resources/data/timezones/to.json
  117. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/tr.json
  118. +247 −253 src/Symfony/Component/Intl/Resources/data/timezones/tt.json
  119. +8 −15 src/Symfony/Component/Intl/Resources/data/timezones/ug.json
  120. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/uk.json
  121. +9 −13 src/Symfony/Component/Intl/Resources/data/timezones/ur.json
  122. +1 −7 src/Symfony/Component/Intl/Resources/data/timezones/uz.json
  123. +11 −0 src/Symfony/Component/Intl/Resources/data/timezones/uz_Cyrl.json
  124. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/vi.json
  125. +1 −7 src/Symfony/Component/Intl/Resources/data/timezones/wo.json
  126. +1 −13 src/Symfony/Component/Intl/Resources/data/timezones/yi.json
  127. +233 −237 src/Symfony/Component/Intl/Resources/data/timezones/yo.json
  128. +233 −1 src/Symfony/Component/Intl/Resources/data/timezones/yo_BJ.json
  129. +7 −13 src/Symfony/Component/Intl/Resources/data/timezones/zh.json
  130. +0 −202 src/Symfony/Component/Intl/Resources/data/timezones/zh_HK.json
  131. +434 −1 src/Symfony/Component/Intl/Resources/data/timezones/zh_Hans_SG.json
  132. +6 −3 src/Symfony/Component/Intl/Resources/data/timezones/zh_Hant.json
  133. +1 −3 src/Symfony/Component/Intl/Resources/data/timezones/zh_Hant_HK.json
  134. +0 −7 src/Symfony/Component/Intl/Resources/data/timezones/zh_SG.json
  135. +9 −15 src/Symfony/Component/Intl/Resources/data/timezones/zu.json
  136. +1 −1 src/Symfony/Component/Intl/Timezones.php
@@ -28,18 +28,24 @@
*/
class TimezoneDataGenerator extends AbstractDataGenerator
{
use FallbackTrait;
/**
* Collects all available zone IDs.
*
* @var string[]
*/
private $zoneIds = [];
private $zoneToCountryMapping = [];
private $localeAliases = [];
/**
* {@inheritdoc}
*/
protected function scanLocales(LocaleScanner $scanner, $sourceDir)
{
$this->localeAliases = $scanner->scanAliases($sourceDir.'/locales');
return $scanner->scanLocales($sourceDir.'/zone');
}
@@ -63,50 +69,71 @@ protected function compileTemporaryBundles(BundleCompilerInterface $compiler, $s
protected function preGenerate()
{
$this->zoneIds = [];
$this->zoneToCountryMapping = [];
}
/**
* {@inheritdoc}
*/
protected function generateDataForLocale(BundleEntryReaderInterface $reader, $tempDir, $displayLocale)
{
$localeBundle = $reader->read($tempDir, $displayLocale);
if (!$this->zoneToCountryMapping) {
$this->zoneToCountryMapping = self::generateZoneToCountryMapping($reader->read($tempDir, 'windowsZones'));
}
if (isset($localeBundle['zoneStrings']) && null !== $localeBundle['zoneStrings']) {
$localeBundles = [$localeBundle];
$fallback = $displayLocale;
while (null !== ($fallback = Locale::getFallback($fallback))) {
$localeBundles[] = $reader->read($tempDir, $fallback);
}
$metadata = [];
$data = [
'Version' => $localeBundle['Version'],
'Names' => $this->generateZones(
$reader,
$tempDir,
$displayLocale,
$localeBundles,
$metadata
),
];
if (!$data['Names'] && !$metadata) {
return;
}
// Don't generate aliases, as they are resolved during runtime
// Unless an alias is needed as fallback for de-duplication purposes
if (isset($this->localeAliases[$displayLocale]) && !$this->generatingFallback) {
return;
}
$data['Meta'] = $metadata;
$localeBundle = $reader->read($tempDir, $displayLocale);
if (!isset($localeBundle['zoneStrings']) || null === $localeBundle['zoneStrings']) {
return;
}
$this->zoneIds = array_merge($this->zoneIds, array_keys($data['Names']));
$data = [
'Version' => $localeBundle['Version'],
'Names' => $this->generateZones($reader, $tempDir, $displayLocale),
'Meta' => self::generateZoneMetadata($localeBundle),
];
// Don't de-duplicate a fallback locale
// Ensures the display locale can be de-duplicated on itself
if ($this->generatingFallback) {
return $data;
}
// Process again to de-duplicate locales and their fallback locales
// Only keep the differences
$fallback = $this->generateFallbackData($reader, $tempDir, $displayLocale);
if (isset($fallback['Names'])) {
$data['Names'] = array_diff($data['Names'], $fallback['Names']);
}
if (isset($fallback['Meta'])) {
$data['Meta'] = array_diff($data['Meta'], $fallback['Meta']);
}
if (!$data['Names'] && !$data['Meta']) {
return;
}
$this->zoneIds = array_merge($this->zoneIds, array_keys($data['Names']));
return $data;
}
/**
* {@inheritdoc}
*/
protected function generateDataForRoot(BundleEntryReaderInterface $reader, $tempDir)
{
$rootBundle = $reader->read($tempDir, 'root');
return [
'Version' => $rootBundle['Version'],
'Meta' => self::generateZoneMetadata($rootBundle),
];
}
/**
@@ -119,66 +146,21 @@ protected function generateDataForMeta(BundleEntryReaderInterface $reader, $temp
$this->zoneIds = array_unique($this->zoneIds);
sort($this->zoneIds);
ksort($this->zoneToCountryMapping);
$data = [
'Version' => $rootBundle['Version'],
'Zones' => $this->zoneIds,
'ZoneToCountry' => self::generateZoneToCountryMapping($reader->read($tempDir, 'windowsZones')),
'ZoneToCountry' => $this->zoneToCountryMapping,
'CountryToZone' => self::generateCountryToZoneMapping($this->zoneToCountryMapping),
];
$data['CountryToZone'] = self::generateCountryToZoneMapping($data['ZoneToCountry']);
return $data;
}
/**
* @param ArrayAccessibleResourceBundle[] $localeBundles
*/
private function generateZones(BundleEntryReaderInterface $reader, string $tempDir, string $locale, array $localeBundles, array &$metadata = []): array
private function generateZones(BundleEntryReaderInterface $reader, string $tempDir, string $locale): array
{
$typeBundle = $reader->read($tempDir, 'timezoneTypes');
$metaBundle = $reader->read($tempDir, 'metaZones');
$windowsZonesBundle = $reader->read($tempDir, 'windowsZones');
$accessor = static function (ArrayAccessibleResourceBundle $resourceBundle, array $indices) {
$result = $resourceBundle;
foreach ($indices as $indice) {
$result = $result[$indice] ?? null;
}
return $result;
};
$accessor = static function (array $indices, &$inherited = false) use ($localeBundles, $accessor) {
$inherited = false;
foreach ($localeBundles as $i => $localeBundle) {
$nextLocaleBundle = $localeBundles[$i + 1] ?? null;
$result = $accessor($localeBundle, $indices);
if (null !== $result && (null === $nextLocaleBundle || $result !== $accessor($nextLocaleBundle, $indices))) {
$inherited = 0 !== $i;
return $result;
}
}
return null;
};
$regionFormat = $reader->readEntry($tempDir, $locale, ['zoneStrings', 'regionFormat']);
$fallbackFormat = $reader->readEntry($tempDir, $locale, ['zoneStrings', 'fallbackFormat']);
$zoneToCountry = self::generateZoneToCountryMapping($windowsZonesBundle);
$resolveName = function (string $id, string $city = null) use ($reader, $tempDir, $locale, $regionFormat, $fallbackFormat, $zoneToCountry): ?string {
if (isset($zoneToCountry[$id])) {
try {
$country = $reader->readEntry($tempDir.'/region', $locale, ['Countries', $zoneToCountry[$id]]);
} catch (MissingResourceException $e) {
return null;
}
return null === $city ? str_replace('{0}', $country, $regionFormat) : str_replace(['{0}', '{1}'], [$city, $country], $fallbackFormat);
} elseif (null !== $city) {
return str_replace('{0}', $city, $regionFormat);
} else {
return str_replace(['/', '_'], ' ', 0 === strrpos($id, 'Etc/') ? substr($id, 4) : $id);
}
};
$available = [];
foreach ($typeBundle['typeMap']['timezone'] as $zone => $_) {
if ('Etc:Unknown' === $zone || preg_match('~^Etc:GMT[-+]\d+$~', $zone)) {
@@ -188,64 +170,97 @@ private function generateZones(BundleEntryReaderInterface $reader, string $tempD
$available[$zone] = true;
}
$metaBundle = $reader->read($tempDir, 'metaZones');
$metazones = [];
foreach ($metaBundle['metazoneInfo'] as $zone => $info) {
foreach ($info as $metazone) {
$metazones[$zone] = $metazone->get(0);
}
}
$isBase = false === strpos($locale, '_');
$regionFormat = $reader->readEntry($tempDir, $locale, ['zoneStrings', 'regionFormat']);
$fallbackFormat = $reader->readEntry($tempDir, $locale, ['zoneStrings', 'fallbackFormat']);
$resolveName = function (string $id, string $city = null) use ($reader, $tempDir, $locale, $regionFormat, $fallbackFormat): ?string {
// Resolve default name as described per http://cldr.unicode.org/translation/timezones
if (isset($this->zoneToCountryMapping[$id])) {
try {
$country = $reader->readEntry($tempDir.'/region', $locale, ['Countries', $this->zoneToCountryMapping[$id]]);
} catch (MissingResourceException $e) {
return null;
}
$name = str_replace('{0}', $country, $regionFormat);
return null === $city ? $name : str_replace(['{0}', '{1}'], [$city, $name], $fallbackFormat);
}
if (null !== $city) {
return str_replace('{0}', $city, $regionFormat);
}
return null;
};
$accessor = static function (array $indices, array ...$fallbackIndices) use ($locale, $reader, $tempDir) {
foreach (\func_get_args() as $indices) {
try {
return $reader->readEntry($tempDir, $locale, $indices);
} catch (MissingResourceException $e) {
}
}
return null;
};
$zones = [];
foreach (array_keys($available) as $zone) {
// lg: long generic, e.g. "Central European Time"
// ls: long specific (not DST), e.g. "Central European Standard Time"
// ld: long DST, e.g. "Central European Summer Time"
// ec: example city, e.g. "Amsterdam"
$name = $accessor(['zoneStrings', $zone, 'lg'], $nameInherited) ?? $accessor(['zoneStrings', $zone, 'ls'], $nameInherited);
$city = $accessor(['zoneStrings', $zone, 'ec'], $cityInherited);
$name = $accessor(['zoneStrings', $zone, 'lg'], ['zoneStrings', $zone, 'ls']);
$city = $accessor(['zoneStrings', $zone, 'ec']);
$id = str_replace(':', '/', $zone);
if (null === $name && isset($metazones[$zone])) {
$meta = 'meta:'.$metazones[$zone];
$name = $accessor(['zoneStrings', $meta, 'lg'], $nameInherited) ?? $accessor(['zoneStrings', $meta, 'ls'], $nameInherited);
$name = $accessor(['zoneStrings', $meta, 'lg'], ['zoneStrings', $meta, 'ls']);
}
// Infer a default English named city for all locales
// Ensures each timezone ID has a distinctive name
if (null === $city && 0 !== strrpos($zone, 'Etc:') && false !== $i = strrpos($zone, ':')) {
$city = str_replace('_', ' ', substr($zone, $i + 1));
$cityInherited = !$isBase;
}
if ($isBase && null === $name) {
if (null === $name) {
$name = $resolveName($id, $city);
$city = null;
}
if (
($nameInherited && $cityInherited)
|| (null === $name && null === $city)
|| ($nameInherited && null === $city)
|| ($cityInherited && null === $name)
) {
if (null === $name) {
continue;
}
if (null === $name) {
$name = $resolveName($id, $city);
} elseif (null !== $city && false === mb_stripos(str_replace('-', ' ', $name), str_replace('-', ' ', $city))) {
// Ensure no duplicated content is generated
if (null !== $city && false === mb_stripos(str_replace('-', ' ', $name), str_replace('-', ' ', $city))) {
$name = str_replace(['{0}', '{1}'], [$city, $name], $fallbackFormat);
}
$zones[$id] = $name;
}
$gmtFormat = $accessor(['zoneStrings', 'gmtFormat'], $gmtFormatInherited) ?? 'GMT{0}';
if (!$gmtFormatInherited || $isBase) {
$metadata['GmtFormat'] = str_replace('{0}', '%s', $gmtFormat);
}
return $zones;
}
$hourFormat = $accessor(['zoneStrings', 'hourFormat'], $hourFormatInherited) ?? '+HH:mm;-HH:mm';
if (!$hourFormatInherited || $isBase) {
$metadata['HourFormat'] = explode(';', str_replace(['HH', 'mm', 'H', 'm'], ['%02d', '%02d', '%d', '%d'], $hourFormat), 2);
private static function generateZoneMetadata(ArrayAccessibleResourceBundle $localeBundle): array
{
$metadata = [];
if (isset($localeBundle['zoneStrings']['gmtFormat'])) {
$metadata['GmtFormat'] = str_replace('{0}', '%s', $localeBundle['zoneStrings']['gmtFormat']);
}
if (isset($localeBundle['zoneStrings']['hourFormat'])) {
$hourFormat = explode(';', str_replace(['HH', 'mm', 'H', 'm'], ['%02d', '%02d', '%d', '%d'], $localeBundle['zoneStrings']['hourFormat']), 2);
$metadata['HourFormatPos'] = $hourFormat[0];
$metadata['HourFormatNeg'] = $hourFormat[1];
}
return $zones;
return $metadata;
}
private static function generateZoneToCountryMapping(ArrayAccessibleResourceBundle $windowsZoneBundle): array
@@ -99,7 +99,7 @@
"America\/Detroit": "Noord-Amerikaanse oostelike tyd (Detroit)",
"America\/Dominica": "Atlantiese tyd (Dominica)",
"America\/Edmonton": "Noord-Amerikaanse bergtyd (Edmonton)",
"America\/Eirunepe": "Brasilië (Eirunepe)",
"America\/Eirunepe": "Brasilië-tyd (Eirunepe)",
"America\/El_Salvador": "Noord-Amerikaanse sentrale tyd (El Salvador)",
"America\/Fort_Nelson": "Noord-Amerikaanse bergtyd (Fort Nelson)",
"America\/Fortaleza": "Brasilia-tyd (Fortaleza)",
@@ -151,7 +151,7 @@
"America\/Moncton": "Atlantiese tyd (Moncton)",
"America\/Monterrey": "Noord-Amerikaanse sentrale tyd (Monterrey)",
"America\/Montevideo": "Uruguay-tyd (Montevideo)",
"America\/Montreal": "Kanada (Montreal)",
"America\/Montreal": "Kanada-tyd (Montreal)",
"America\/Montserrat": "Atlantiese tyd (Montserrat)",
"America\/Nassau": "Noord-Amerikaanse oostelike tyd (Nassau)",
"America\/New_York": "Noord-Amerikaanse oostelike tyd (New York)",
@@ -176,7 +176,7 @@
"America\/Recife": "Brasilia-tyd (Recife)",
"America\/Regina": "Noord-Amerikaanse sentrale tyd (Regina)",
"America\/Resolute": "Noord-Amerikaanse sentrale tyd (Resolute)",
"America\/Rio_Branco": "Brasilië (Rio Branco)",
"America\/Rio_Branco": "Brasilië-tyd (Rio Branco)",
"America\/Santa_Isabel": "Noordwes-Meksiko-tyd (Santa Isabel)",
"America\/Santarem": "Brasilia-tyd (Santarem)",
"America\/Santiago": "Chili-tyd (Santiago)",
@@ -226,7 +226,7 @@
"Asia\/Bahrain": "Arabiese tyd (Bahrein)",
"Asia\/Baku": "Aserbeidjan-tyd (Bakoe)",
"Asia\/Bangkok": "Indosjina-tyd (Bangkok)",
"Asia\/Barnaul": "Rusland (Barnaul)",
"Asia\/Barnaul": "Rusland-tyd (Barnaul)",
"Asia\/Beirut": "Oos-Europese tyd (Beiroet)",
"Asia\/Bishkek": "Kirgistan-tyd (Bisjkek)",
"Asia\/Brunei": "Broenei Darussalam-tyd",
@@ -288,9 +288,9 @@
"Asia\/Tehran": "Iran-tyd (Tehran)",
"Asia\/Thimphu": "Bhoetan-tyd (Thimphu)",
"Asia\/Tokyo": "Japan-tyd (Tokio)",
"Asia\/Tomsk": "Rusland (Tomsk)",
"Asia\/Tomsk": "Rusland-tyd (Tomsk)",
"Asia\/Ulaanbaatar": "Ulaanbaatar-tyd",
"Asia\/Urumqi": "Sjina (Urumqi)",
"Asia\/Urumqi": "Sjina-tyd (Urumqi)",
"Asia\/Ust-Nera": "Wladiwostok-tyd (Ust-Nera)",
"Asia\/Vientiane": "Indosjina-tyd (Vientiane)",
"Asia\/Vladivostok": "Wladiwostok-tyd",
@@ -341,11 +341,11 @@
"Europe\/Guernsey": "Greenwich-tyd (Guernsey)",
"Europe\/Helsinki": "Oos-Europese tyd (Helsinki)",
"Europe\/Isle_of_Man": "Greenwich-tyd (Eiland Man)",
"Europe\/Istanbul": "Turkye (Istanbul)",
"Europe\/Istanbul": "Turkye-tyd (Istanbul)",
"Europe\/Jersey": "Greenwich-tyd (Jersey)",
"Europe\/Kaliningrad": "Oos-Europese tyd (Kaliningrad)",
"Europe\/Kiev": "Oos-Europese tyd (Kiëf)",
"Europe\/Kirov": "Rusland (Kirov)",
"Europe\/Kirov": "Rusland-tyd (Kirov)",
"Europe\/Lisbon": "Wes-Europese tyd (Lissabon)",
"Europe\/Ljubljana": "Sentraal-Europese tyd (Ljubljana)",
"Europe\/London": "Greenwich-tyd (Londen)",
@@ -436,11 +436,5 @@
"Pacific\/Wake": "Wake-eiland-tyd",
"Pacific\/Wallis": "Wallis en Futuna-tyd (Mata-Utu)"
},
"Meta": {
"GmtFormat": "GMT%s",
"HourFormat": [
"+%02d:%02d",
"-%02d:%02d"
]
}
"Meta": []
}
Oops, something went wrong.

0 comments on commit cbbf8b7

Please sign in to comment.
You can’t perform that action at this time.