Skip to content

Commit cb78c31

Browse files
Merge branch '7.3' into 7.4
* 7.3: [Intl] Take timezoneTypes’ ianaMap into account [WebProfilerBundle] Hide WDT clearer when it is hidden
2 parents ca720c0 + 83e780a commit cb78c31

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+2532
-7
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@
113113
background: var(--sf-toolbar-gray-700);
114114
}
115115

116+
.sf-toolbar.sf-toolbar-closed .sf-toolbar-clearer {
117+
display: none;
118+
}
116119
.sf-toolbar.sf-toolbar-closed .sf-toolbarreset .sf-toolbar-block {
117120
display: none;
118121
}

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
</div>
3333
{% endif %}
3434

35-
<button class="sf-toolbar-toggle-button" type="button" id="sfToolbarToggleButton-{{ token }}" title="Close Toolbar" accesskey="D" aria-expanded="true" aria-controls="sfToolbarMainContent-{{ token }}">
36-
<i class="sf-toolbar-icon-opened">{{ source('@WebProfiler/Icon/close.svg') }}</i>
37-
<i class="sf-toolbar-icon-closed">{{ source('@WebProfiler/Icon/symfony.svg') }}</i>
35+
<button class="sf-toolbar-toggle-button" type="button" id="sfToolbarToggleButton-{{ token }}" accesskey="D" aria-expanded="true" aria-controls="sfToolbarMainContent-{{ token }}">
36+
<i class="sf-toolbar-icon-opened" title="Close Toolbar">{{ source('@WebProfiler/Icon/close.svg') }}</i>
37+
<i class="sf-toolbar-icon-closed" title="Open Toolbar">{{ source('@WebProfiler/Icon/symfony.svg') }}</i>
3838
</button>
3939
</div>

src/Symfony/Component/Intl/Data/Generator/TimezoneDataGenerator.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class TimezoneDataGenerator extends AbstractDataGenerator
3737
private array $zoneIds = [];
3838
private array $zoneToCountryMapping = [];
3939
private array $localeAliases = [];
40+
private array $ianaMap = [];
4041

4142
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
4243
{
@@ -64,8 +65,14 @@ protected function preGenerate(): void
6465

6566
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
6667
{
68+
if (!$this->ianaMap) {
69+
foreach ($reader->readEntry($tempDir, 'timezoneTypes', ['ianaMap', 'timezone']) as $cldr => $iana) {
70+
$this->ianaMap[str_replace(':', '/', $cldr)] = $iana;
71+
}
72+
}
73+
6774
if (!$this->zoneToCountryMapping) {
68-
$this->zoneToCountryMapping = self::generateZoneToCountryMapping($reader->read($tempDir, 'windowsZones'));
75+
$this->zoneToCountryMapping = $this->generateZoneToCountryMapping($reader->read($tempDir, 'windowsZones'));
6976
}
7077

7178
// Don't generate aliases, as they are resolved during runtime
@@ -76,7 +83,7 @@ protected function generateDataForLocale(BundleEntryReaderInterface $reader, str
7683

7784
$localeBundle = $reader->read($tempDir, $displayLocale);
7885

79-
if (!isset($localeBundle['zoneStrings']) || null === $localeBundle['zoneStrings']) {
86+
if (!isset($localeBundle['zoneStrings'])) {
8087
return null;
8188
}
8289

@@ -217,6 +224,10 @@ private function generateZones(BundleEntryReaderInterface $reader, string $tempD
217224
}
218225

219226
$zones[$id] = $name;
227+
228+
if (isset($this->ianaMap[$id])) {
229+
$zones[$this->ianaMap[$id]] = $name;
230+
}
220231
}
221232

222233
return $zones;
@@ -237,14 +248,20 @@ private static function generateZoneMetadata(ArrayAccessibleResourceBundle $loca
237248
return $metadata;
238249
}
239250

240-
private static function generateZoneToCountryMapping(ArrayAccessibleResourceBundle $windowsZoneBundle): array
251+
private function generateZoneToCountryMapping(ArrayAccessibleResourceBundle $windowsZoneBundle): array
241252
{
242253
$mapping = [];
243254

244255
foreach ($windowsZoneBundle['mapTimezones'] as $zoneInfo) {
245256
foreach ($zoneInfo as $region => $zones) {
246257
if (RegionDataGenerator::isValidCountryCode($region)) {
247-
$mapping += array_fill_keys(explode(' ', $zones), $region);
258+
foreach (explode(' ', $zones) as $zone) {
259+
$mapping[$zone] = $region;
260+
261+
if (isset($this->ianaMap[$zone])) {
262+
$mapping[$this->ianaMap[$zone]] = $region;
263+
}
264+
}
248265
}
249266
}
250267
}

src/Symfony/Component/Intl/Resources/data/timezones/af.php

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Symfony/Component/Intl/Resources/data/timezones/ak.php

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)