Skip to content

Commit 8fdcd6e

Browse files
committed
feature #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 #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

+20-3
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

+7
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

+7
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

+7
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

+7
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

+7
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

+7
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

+7
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

+7
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

+7
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
}

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

+7
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "Mikronezia (Chuuk)",
436436
"Pacific\/Wake": "Inizi diabell ar Stadoù-Unanet (Wake)",
437437
"Pacific\/Wallis": "eur Wallis ha Futuna"
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/bs.json

+7
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "Čučko vrijeme (Chuuk)",
436436
"Pacific\/Wake": "Vrijeme na Ostrvu Vejk (Wake)",
437437
"Pacific\/Wallis": "Vrijeme na Ostrvima Valis i Futuna"
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/bs_Cyrl.json

+7
Original file line numberDiff line numberDiff line change
@@ -429,5 +429,12 @@
429429
"Pacific\/Truk": "Трук време",
430430
"Pacific\/Wake": "Вејк острво време",
431431
"Pacific\/Wallis": "Валис и Футуна Острва време"
432+
},
433+
"Meta": {
434+
"GmtFormat": "GMT%s",
435+
"HourFormat": [
436+
"+%02d%02d",
437+
"-%02d%02d"
438+
]
432439
}
433440
}

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

+7
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "Hora de Chuuk",
436436
"Pacific\/Wake": "Hora de Wake",
437437
"Pacific\/Wallis": "Hora de Wallis i Futuna"
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/ce.json

+7
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/cs.json

+7
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "Chuukský čas (Chuukské ostrovy)",
436436
"Pacific\/Wake": "Čas ostrova Wake",
437437
"Pacific\/Wallis": "Čas ostrovů Wallis a Futuna"
438+
},
439+
"Meta": {
440+
"GmtFormat": "GMT%s",
441+
"HourFormat": [
442+
"+%d:%02d",
443+
"-%d:%02d"
444+
]
438445
}
439446
}

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

+7
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "Amser Chuuk",
436436
"Pacific\/Wake": "Amser Ynys Wake",
437437
"Pacific\/Wallis": "Amser Wallis a Futuna"
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/da.json

+7
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "Chuuk-tid",
436436
"Pacific\/Wake": "Wake Island-tid",
437437
"Pacific\/Wallis": "Wallis og Futuna-tid"
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/de.json

+7
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "Chuuk-Zeit",
436436
"Pacific\/Wake": "Wake-Insel-Zeit",
437437
"Pacific\/Wallis": "Wallis-und-Futuna-Zeit"
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/de_CH.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"Asia\/Macau": "Chinesische Zeit (Macao)",
66
"Europe\/Saratov": "Moskauer Zeit (Saratov)",
77
"Pacific\/Guadalcanal": "Salomoninseln-Zeit (Guadalcanal)"
8-
}
8+
},
9+
"Meta": []
910
}

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

+7
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "མའི་ཀྲོ་ནི་ཤི་ཡ། (Chuuk་)",
436436
"Pacific\/Wake": "ཡུ་ཨེས་གྱི་མཐའ་མཚམས་མཚོ་གླིང་། (Wake་)",
437437
"Pacific\/Wallis": "ཝལ་ལིས྄་ ཨེནཌ་ ཕུ་ཏུ་ན་། (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/ee.json

+7
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "Chuuk gaƒoƒo me",
436436
"Pacific\/Wake": "Wake Island gaƒoƒo me",
437437
"Pacific\/Wallis": "Wallis & Futuna gaƒoƒo me"
438+
},
439+
"Meta": {
440+
"GmtFormat": "%s GMT",
441+
"HourFormat": [
442+
"+%02d:%02d",
443+
"-%02d:%02d"
444+
]
438445
}
439446
}

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

+7
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/en.json

+7
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "Chuuk Time",
436436
"Pacific\/Wake": "Wake Island Time",
437437
"Pacific\/Wallis": "Wallis & Futuna Time"
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/en_AU.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@
3434
"Indian\/Comoro": "Eastern Africa Time (Comoro)",
3535
"Indian\/Mayotte": "Eastern Africa Time (Mayotte)",
3636
"Pacific\/Rarotonga": "Cook Island Time (Rarotonga)"
37-
}
37+
},
38+
"Meta": []
3839
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"Version": "2.1.47.86",
33
"Names": {
44
"Asia\/Rangoon": "Myanmar Time (Rangoon)"
5-
}
5+
},
6+
"Meta": []
67
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
"America\/St_Thomas": "Atlantic Time (St Thomas)",
1010
"America\/St_Vincent": "Atlantic Time (St Vincent)",
1111
"Atlantic\/St_Helena": "Greenwich Mean Time (St Helena)"
12-
}
12+
},
13+
"Meta": []
1314
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"Version": "2.1.49.14",
33
"Names": {
44
"Asia\/Rangoon": "Myanmar Time (Rangoon)"
5-
}
5+
},
6+
"Meta": []
67
}

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

+7
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,12 @@
435435
"Pacific\/Truk": "hora de Chuuk",
436436
"Pacific\/Wake": "hora de la isla Wake",
437437
"Pacific\/Wallis": "hora de Wallis y Futuna"
438+
},
439+
"Meta": {
440+
"GmtFormat": "GMT%s",
441+
"HourFormat": [
442+
"+%02d:%02d",
443+
"-%02d:%02d"
444+
]
438445
}
439446
}

0 commit comments

Comments
 (0)