8000 feature #31318 [Intl] Compile localized timezone offset name (ro0NL) · weaverryan/symfony@8fdcd6e · GitHub
[go: up one dir, main page]

Skip to content

Commit 8fdcd6e

Browse files
committed
feature symfony#31318 [Intl] Compile localized timezone offset name (ro0NL)
This PR was merged into the 4.3-dev branch. Discussion ---------- [Intl] Compile localized timezone offset name | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes-ish | New feature? | yes | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no | Tests pass? | yes (including intl-data group) | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> A tiny follow up of symfony#31295 Commits ------- 7a40d20 [Intl] Compile localized timezone offset name
2 parents 0c78413 + 7a40d20 commit 8fdcd6e

Some content is hidden

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

145 files changed

+914
-26
lines changed

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,25 @@ protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir
8686
if ('root' !== $displayLocale) {
8787
$localeBundles[] = $reader->read($tempDir, 'root');
8888
}
89+
$metadata = [];
8990
$data = [
9091
'Version' => $localeBundle['Version'],
9192
'Names' => $this->generateZones(
9293
$displayLocale,
9394
$reader->read($tempDir, 'timezoneTypes'),
9495
$reader->read($tempDir, 'metaZones'),
9596
$reader->read($tempDir, 'windowsZones'),
96-
...$localeBundles
97+
$localeBundles,
98+
$metadata
9799
),
98100
];
99101

100-
if (!$data['Names']) {
102+
if (!$data['Names'] && !$metadata) {
101103
return;
102104
}
103105

106+
$data['Meta'] = $metadata;
107+
104108
$this->zoneIds = array_merge($this->zoneIds, array_keys($data['Names']));
105109

106110
return $data;
@@ -136,7 +140,10 @@ protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir)
136140
return $data;
137141
}
138142

139-
private function generateZones(string $locale, ArrayAccessibleResourceBundle $typeBundle, ArrayAccessibleResourceBundle $metaBundle, ArrayAccessibleResourceBundle $windowsZonesBundle, ArrayAccessibleResourceBundle ...$localeBundles): array
143+
/**
144+
* @param ArrayAccessibleResourceBundle[] $localeBundles
145+
*/
146+
private function generateZones(string $locale, ArrayAccessibleResourceBundle $typeBundle, ArrayAccessibleResourceBundle $metaBundle, ArrayAccessibleResourceBundle $windowsZonesBundle, array $localeBundles, array &$metadata = []): array
140147
{
141148
$accessor = static function (ArrayAccessibleResourceBundle $resourceBundle, array $indices) {
142149
$result = $resourceBundle;
@@ -234,6 +241,16 @@ private function generateZones(string $locale, ArrayAccessibleResourceBundle $ty
234241
$zones[$id] = $name;
235242
}
236243

244+
$gmtFormat = $accessor(['zoneStrings', 'gmtFormat'], $gmtFormatInherited) ?? 'GMT{0}';
245+
if (!$gmtFormatInherited || $isBase) {
246+
$metadata['GmtFormat'] = str_replace('{0}', '%s', $gmtFormat);
247+
}
248+
249+
$hourFormat = $accessor(['zoneStrings', 'hourFormat'], $hourFormatInherited) ?? '+HH:mm;-HH:mm';
250+
if (!$hourFormatInherited || $isBase) {
251+
$metadata['HourFormat'] = explode(';', str_replace(['HH', 'mm', 'H', 'm'], ['%02d', '%02d', '%d', '%d'], $hourFormat), 2);
252+
}
253+
237254
return $zones;
238255
}
239256

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "Chuuk-tyd",
436436
"Pacific\/Wake": "Wake-eiland-tyd",
437437
"Pacific\/Wallis": "Wallis en Futuna-tyd (Mata-Utu)"
438+
},
439+
"Meta": {
440+
"GmtFormat": "GMT%s",
441+
"HourFormat": [
442+
"+%02d:%02d",
443+
"-%02d:%02d"
444+
]
438445
}
439446
}

src/Symfony/Component/Intl/Resources/data/timezones/am.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "የቹክ ሰዓት",
436436
"Pacific\/Wake": "የዌክ ደሴት ሰዓት (ዋኬ)",
437437
"Pacific\/Wallis": "የዋሊስ እና ፉቱና ሰዓት"
438+
},
439+
"Meta": {
440+
"GmtFormat": "ጂ ኤም ቲ%s",
441+
"HourFormat": [
442+
"+%02d%02d",
443+
"-%02d%02d"
444+
]
438445
}
439446
}

src/Symfony/Component/Intl/Resources/data/timezones/ar.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "توقيت شوك (ترك)",
436436
"Pacific\/Wake": "توقيت جزيرة ويك (واك)",
437437
"Pacific\/Wallis": "توقيت واليس و فوتونا"
438+
},
439+
"Meta": {
440+
"GmtFormat": "غرينتش%s",
441+
"HourFormat": [
442+
"+%02d:%02d",
443+
"-%02d:%02d"
444+
]
438445
}
439446
}

src/Symfony/Component/Intl/Resources/data/timezones/as.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "চ্চুকৰ সময়",
436436
"Pacific\/Wake": "ৱেক দ্বীপৰ সময়",
437437
"Pacific\/Wallis": "ৱালিছ আৰু ফুটুনাৰ সময়"
438+
},
439+
"Meta": {
440+
"GmtFormat": "GMT%s",
441+
"HourFormat": [
442+
"+%02d:%02d",
443+
"-%02d:%02d"
444+
]
438445
}
439446
}

src/Symfony/Component/Intl/Resources/data/timezones/az.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "Çuuk Vaxtı",
436436
"Pacific\/Wake": "Ueyk Vaxtı (Veyk)",
437437
"Pacific\/Wallis": "Uollis və Futuna Vaxtı"
438+
},
439+
"Meta": {
440+
"GmtFormat": "GMT%s",
441+
"HourFormat": [
442+
"+%02d:%02d",
443+
"-%02d:%02d"
444+
]
438445
}
439446
}

src/Symfony/Component/Intl/Resources/data/timezones/be.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "Час Чуук",
436436
"Pacific\/Wake": "Час вострава Уэйк",
437437
"Pacific\/Wallis": "Час астравоў Уоліс і Футуна"
438+
},
439+
"Meta": {
440+
"GmtFormat": "GMT%s",
441+
"HourFormat": [
442+
"+%02d.%02d",
443+
"-%02d.%02d"
444+
]
438445
}
439446
}

src/Symfony/Component/Intl/Resources/data/timezones/bg.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "Чуюк",
436436
"Pacific\/Wake": "Остров Уейк",
437437
"Pacific\/Wallis": "Уолис и Футуна"
438+
},
439+
"Meta": {
440+
"GmtFormat": "Гринуич%s",
441+
"HourFormat": [
442+
"+%02d:%02d",
443+
"-%02d:%02d"
444+
]
438445
}
439446
}

src/Symfony/Component/Intl/Resources/data/timezones/bn.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "চুক সময়",
436436
"Pacific\/Wake": "ওয়েক দ্বীপ সময়",
437437
"Pacific\/Wallis": "ওয়ালিস এবং ফুটুনা সময় (ওলিস)"
438+
},
439+
"Meta": {
440+
"GmtFormat": "GMT %s",
441+
"HourFormat": [
442+
"+%02d:%02d",
443+
"-%02d:%02d"
444+
]
438445
}
439446
}

src/Symfony/Component/Intl/Resources/data/timezones/bo.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "Micronesia (Chuuk)",
436436
"Pacific\/Wake": "U.S. Outlying Islands (Wake)",
437437
"Pacific\/Wallis": "Wallis & Futuna (Wallis)"
438+
},
439+
"Meta": {
440+
"GmtFormat": "GMT%s",
441+
"HourFormat": [
442+
"+%02d:%02d",
443+
"-%02d:%02d"
444+
]
438445
}
439446
}

0 commit comments

Comments
 (0)
0