Skip to content

Commit c4abc15

Browse files
committed
minor symfony#22627 [Intl] Update ICU data to 59.1 (jakzal)
This PR was squashed before being merged into the 2.7 branch (closes symfony#22627). Discussion ---------- [Intl] Update ICU data to 59.1 | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - The [GMT timezone has been split from the UTC](http://site.icu-project.org/download/59) timezone [in CLDR](http://cldr.unicode.org/index/downloads/cldr-31) (which ICU is based on). For example, the code blow: * before ICU 59.1 would return "GMT" in all cases * with ICU 59.1 it returns "UTC" for the first three ('z', 'zz', 'zzz') and "Coordinated Universal Time" for the last two ('zzzz', 'zzzzz'). ```php foreach (['z', 'zz', 'zzz', 'zzzz', 'zzzzz'] as $pattern) { $formatter = new \IntlDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, new \DateTimeZone('UTC'), IntlDateFormatter::GREGORIAN, $pattern); var_dump($formatter->format(new \DateTime('@0'))); } ``` Similarly Form's `DateTimeToLocalizedStringTransformer` is also affected: ```php $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, \IntlDateFormatter::FULL); var_dump($transformer->transform(new \DateTime('2010-02-03 04:05:06 UTC'))); // ICU 58.2: '03.02.2010, 04:05:06 GMT' // ICU 59.1: '03.02.2010, 04:05:06 Koordinierte Weltzeit' ``` Refer to added and modified test cases for more changes. I split this PR in two commits for easier review. First commit updates ICU data (generated files), the second updates code and test cases to be compatible with updated data. Commits ------- 5d3d1b2 [Intl][Form] Update tests, TimeZoneTransformer, and DateTimeToLocalizedStringTransformer for the GMT and UTC split in ICU 00acb37 [Intl] Update ICU data to 59.1
2 parents 1c2c3fc + 5d3d1b2 commit c4abc15

File tree

921 files changed

+1471
-1094
lines changed

Some content is hidden

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

921 files changed

+1471
-1094
lines changed

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,13 @@ public function dataProvider()
6161
array(\IntlDateFormatter::FULL, \IntlDateFormatter::NONE, null, 'Mittwoch, 3. Februar 2010', '2010-02-03 00:00:00 UTC'),
6262
array(null, \IntlDateFormatter::SHORT, null, '03.02.2010, 04:05', '2010-02-03 04:05:00 UTC'),
6363
array(null, \IntlDateFormatter::MEDIUM, null, '03.02.2010, 04:05:06', '2010-02-03 04:05:06 UTC'),
64-
array(null, \IntlDateFormatter::LONG, null, '03.02.2010, 04:05:06 GMT', '2010-02-03 04:05:06 UTC'),
64+
array(null, \IntlDateFormatter::LONG, null, '03.02.2010, 04:05:06 UTC', '2010-02-03 04:05:06 UTC'),
65+
array(null, \IntlDateFormatter::LONG, null, '03.02.2010, 04:05:06 UTC', '2010-02-03 04:05:06 GMT'),
6566
// see below for extra test case for time format FULL
6667
array(\IntlDateFormatter::NONE, \IntlDateFormatter::SHORT, null, '04:05', '1970-01-01 04:05:00 UTC'),
6768
array(\IntlDateFormatter::NONE, \IntlDateFormatter::MEDIUM, null, '04:05:06', '1970-01-01 04:05:06 UTC'),
68-
array(\IntlDateFormatter::NONE, \IntlDateFormatter::LONG, null, '04:05:06 GMT', '1970-01-01 04:05:06 UTC'),
69+
array(\IntlDateFormatter::NONE, \IntlDateFormatter::LONG, null, '04:05:06 UTC', '1970-01-01 04:05:06 GMT'),
70+
array(\IntlDateFormatter::NONE, \IntlDateFormatter::LONG, null, '04:05:06 UTC', '1970-01-01 04:05:06 UTC'),
6971
array(null, null, 'yyyy-MM-dd HH:mm:00', '2010-02-03 04:05:00', '2010-02-03 04:05:00 UTC'),
7072
array(null, null, 'yyyy-MM-dd HH:mm', '2010-02-03 04:05', '2010-02-03 04:05:00 UTC'),
7173
array(null, null, 'yyyy-MM-dd HH', '2010-02-03 04', '2010-02-03 04:00:00 UTC'),
@@ -85,6 +87,9 @@ public function dataProvider()
8587
*/
8688
public function testTransform($dateFormat, $timeFormat, $pattern, $output, $input)
8789
{
90+
IntlTestHelper::requireFullIntl($this, '59.1');
91+
\Locale::setDefault('de_AT');
92+
8893
$transformer = new DateTimeToLocalizedStringTransformer(
8994
'UTC',
9095
'UTC',
@@ -101,9 +106,12 @@ public function testTransform($dateFormat, $timeFormat, $pattern, $output, $inpu
101106

102107
public function testTransformFullTime()
103108
{
109+
IntlTestHelper::requireFullIntl($this, '59.1');
110+
\Locale::setDefault('de_AT');
111+
104112
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, \IntlDateFormatter::FULL);
105113

106-
$this->assertEquals('03.02.2010, 04:05:06 GMT', $transformer->transform($this->dateTime));
114+
$this->assertEquals('03.02.2010, 04:05:06 Koordinierte Weltzeit', $transformer->transform($this->dateTime));
107115
}
108116

109117
public function testTransformToDifferentLocale()

src/Symfony/Component/Intl/DateFormatter/DateFormat/TimeZoneTransformer.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,29 @@ public function format(\DateTime $dateTime, $length)
3333
throw new NotImplementedException('Time zone different than GMT or UTC is not supported as a formatting output.');
3434
}
3535

36-
// From ICU >= 4.8, the zero offset is not more used, example: GMT instead of GMT+00:00
37-
$format = (0 !== (int) $dateTime->format('O')) ? '\G\M\TP' : '\G\M\T';
36+
if ('Etc' === $timeZone) {
37+
// i.e. Etc/GMT+1, Etc/UTC, Etc/Zulu
38+
$timeZone = substr($dateTime->getTimezone()->getName(), 4);
39+
}
40+
41+
// From ICU >= 59.1 GMT and UTC are no longer unified
42+
if (in_array($timeZone, array('UTC', 'UCT', 'Universal', 'Zulu'))) {
43+
// offset is not supported with UTC
44+
return $length > 3 ? 'Coordinated Universal Time' : 'UTC';
45+
}
46+
47+
$offset = (int) $dateTime->format('O');
48+
49+
// From ICU >= 4.8, the zero offset is no more used, example: GMT instead of GMT+00:00
50+
if (0 === $offset) {
51+
return $length > 3 ? 'Greenwich Mean Time' : 'GMT';
52+
}
53+
54+
if ($length > 3) {
55+
return $dateTime->format('\G\M\TP');
56+
}
3857

39-
return $dateTime->format($format);
58+
return sprintf('GMT%s%d', ($offset >= 0 ? '+' : ''), $offset / 100);
4059
}
4160

4261
/**

src/Symfony/Component/Intl/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@ Resources
1515
* [Report issues](https://github.com/symfony/symfony/issues) and
1616
[send Pull Requests](https://github.com/symfony/symfony/pulls)
1717
in the [main Symfony repository](https://github.com/symfony/symfony)
18+
* [Docker images with intl support](https://hub.docker.com/r/jakzal/php-intl)
19+
(for the Intl component development)
1820

1921
[0]: http://www.php.net/manual/en/intl.setup.php

src/Symfony/Component/Intl/Resources/bin/icu.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
55 = http://source.icu-project.org/repos/icu/icu/tags/release-55-1/source
1515
57 = http://source.icu-project.org/repos/icu/icu/tags/release-57-1/source
1616
58 = http://source.icu-project.org/repos/icu/tags/release-58-2/icu4c/source
17+
59 = http://source.icu-project.org/repos/icu/tags/release-59-1/icu4c/source

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Version": "2.1.29.44",
2+
"Version": "2.1.32.59",
33
"Names": {
44
"AED": [
55
"AED",
@@ -451,7 +451,7 @@
451451
],
452452
"PEN": [
453453
"PEN",
454-
"Peruaanse nuwe sol"
454+
"Peruaanse sol"
455455
],
456456
"PGK": [
457457
"PGK",

src/Symfony/Component/Intl/Resources/data/currencies/af_NA.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Version": "2.1.27.40",
2+
"Version": "2.1.31.33",
33
"Names": {
44
"NAD": [
55
"$",

src/Symfony/Component/Intl/Resources/data/currencies/ak.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Version": "2.1.27.40",
2+
"Version": "2.1.31.33",
33
"Names": {
44
"AED": [
55
"AED",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Version": "2.1.28.79",
2+
"Version": "2.1.32.59",
33
"Names": {
44
"AED": [
55
"AED",
@@ -439,7 +439,7 @@
439439
],
440440
"PEN": [
441441
"PEN",
442-
"የፔሩቪያ ኑኤቮ ሶል"
442+
"የፔሩቪያ ሶል"
443443
],
444444
"PGK": [
445445
"PGK",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Version": "2.1.28.79",
2+
"Version": "2.1.32.86",
33
"Names": {
44
"ADP": [
55
"ADP",
@@ -647,7 +647,7 @@
647647
],
648648
"PEN": [
649649
"PEN",
650-
"سول جديد البيرو"
650+
"سول البيرو"
651651
],
652652
"PGK": [
653653
"PGK",

src/Symfony/Component/Intl/Resources/data/currencies/ar_DJ.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Version": "2.1.27.40",
2+
"Version": "2.1.31.33",
33
"Names": {
44
"DJF": [
55
"Fdj",

0 commit comments

Comments
 (0)