Skip to content

[Intl] Update ICU to version 55 #18019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ public static function assertEquals($expected, $actual, $message = '', $delta =
public function dataProvider()
{
return array(
array(\IntlDateFormatter::SHORT, null, null, '03.02.10 04:05', '2010-02-03 04:05:00 UTC'),
array(\IntlDateFormatter::MEDIUM, null, null, '03.02.2010 04:05', '2010-02-03 04:05:00 UTC'),
array(\IntlDateFormatter::LONG, null, null, '03. Februar 2010 04:05', '2010-02-03 04:05:00 UTC'),
array(\IntlDateFormatter::FULL, null, null, 'Mittwoch, 03. Februar 2010 04:05', '2010-02-03 04:05:00 UTC'),
array(\IntlDateFormatter::SHORT, null, null, '03.02.10, 04:05', '2010-02-03 04:05:00 UTC'),
array(\IntlDateFormatter::MEDIUM, null, null, '03.02.2010, 04:05', '2010-02-03 04:05:00 UTC'),
array(\IntlDateFormatter::LONG, null, null, '3. Februar 2010 um 04:05', '2010-02-03 04:05:00 UTC'),
array(\IntlDateFormatter::FULL, null, null, 'Mittwoch, 3. Februar 2010 um 04:05', '2010-02-03 04:05:00 UTC'),
array(\IntlDateFormatter::SHORT, \IntlDateFormatter::NONE, null, '03.02.10', '2010-02-03 00:00:00 UTC'),
array(\IntlDateFormatter::MEDIUM, \IntlDateFormatter::NONE, null, '03.02.2010', '2010-02-03 00:00:00 UTC'),
array(\IntlDateFormatter::LONG, \IntlDateFormatter::NONE, null, '03. Februar 2010', '2010-02-03 00:00:00 UTC'),
array(\IntlDateFormatter::FULL, \IntlDateFormatter::NONE, null, 'Mittwoch, 03. Februar 2010', '2010-02-03 00:00:00 UTC'),
array(null, \IntlDateFormatter::SHORT, null, '03.02.2010 04:05', '2010-02-03 04:05:00 UTC'),
array(null, \IntlDateFormatter::MEDIUM, null, '03.02.2010 04:05:06', '2010-02-03 04:05:06 UTC'),
array(null, \IntlDateFormatter::LONG, null, '03.02.2010 04:05:06 GMT', '2010-02-03 04:05:06 UTC'),
array(\IntlDateFormatter::LONG, \IntlDateFormatter::NONE, null, '3. Februar 2010', '2010-02-03 00:00:00 UTC'),
array(\IntlDateFormatter::FULL, \IntlDateFormatter::NONE, null, 'Mittwoch, 3. Februar 2010', '2010-02-03 00:00:00 UTC'),
array(null, \IntlDateFormatter::SHORT, null, '03.02.2010, 04:05', '2010-02-03 04:05:00 UTC'),
array(null, \IntlDateFormatter::MEDIUM, null, '03.02.2010, 04:05:06', '2010-02-03 04:05:06 UTC'),
array(null, \IntlDateFormatter::LONG, null, '03.02.2010, 04:05:06 GMT', '2010-02-03 04:05:06 UTC'),
// see below for extra test case for time format FULL
array(\IntlDateFormatter::NONE, \IntlDateFormatter::SHORT, null, '04:05', '1970-01-01 04:05:00 UTC'),
array(\IntlDateFormatter::NONE, \IntlDateFormatter::MEDIUM, null, '04:05:06', '1970-01-01 04:05:06 UTC'),
Expand Down Expand Up @@ -103,7 +103,7 @@ public function testTransformFullTime()
{
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, \IntlDateFormatter::FULL);

$this->assertEquals('03.02.2010 04:05:06 GMT', $transformer->transform($this->dateTime));
$this->assertEquals('03.02.2010, 04:05:06 GMT', $transformer->transform($this->dateTime));
}

public function testTransformToDifferentLocale()
Expand Down Expand Up @@ -131,7 +131,7 @@ public function testTransformWithDifferentTimezones()
$dateTime = clone $input;
$dateTime->setTimezone(new \DateTimeZone('Asia/Hong_Kong'));

$this->assertEquals($dateTime->format('d.m.Y H:i'), $transformer->transform($input));
$this->assertEquals($dateTime->format('d.m.Y, H:i'), $transformer->transform($input));
}

public function testTransformWithDifferentPatterns()
Expand All @@ -153,7 +153,7 @@ public function testTransformDateTimeImmutableTimezones()
$dateTime = clone $input;
$dateTime = $dateTime->setTimezone(new \DateTimeZone('Asia/Hong_Kong'));

$this->assertEquals($dateTime->format('d.m.Y H:i'), $transformer->transform($input));
$this->assertEquals($dateTime->format('d.m.Y, H:i'), $transformer->transform($input));
}

/**
Expand Down Expand Up @@ -201,7 +201,7 @@ public function testReverseTransformFullTime()
{
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, \IntlDateFormatter::FULL);

$this->assertDateTimeEquals($this->dateTime, $transformer->reverseTransform('03.02.2010 04:05:06 GMT+00:00'));
$this->assertDateTimeEquals($this->dateTime, $transformer->reverseTransform('03.02.2010, 04:05:06 GMT+00:00'));
}

public function testReverseTransformFromDifferentLocale()
Expand All @@ -220,7 +220,7 @@ public function testReverseTransformWithDifferentTimezones()
$dateTime = new \DateTime('2010-02-03 04:05:00 Asia/Hong_Kong');
$dateTime->setTimezone(new \DateTimeZone('America/New_York'));

$this->assertDateTimeEquals($dateTime, $transformer->reverseTransform('03.02.2010 04:05'));
$this->assertDateTimeEquals($dateTime, $transformer->reverseTransform('03.02.2010, 04:05'));
}

public function testReverseTransformWithDifferentPatterns()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ public function testMonthsOptionShortFormat()
$view = $form->createView();

$this->assertEquals(array(
new ChoiceView(1, '1', 'Jän'),
new ChoiceView(1, '1', 'Jän.'),
new ChoiceView(4, '4', 'Apr.'),
), $view['month']->vars['choices']);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class LanguageDataGenerator extends AbstractDataGenerator
'fr' => 'fra',
'gn' => 'grn',
'hy' => 'hye',
'hr' => 'hrv',
'ik' => 'ipk',
'is' => 'isl',
'iu' => 'iku',
Expand Down Expand Up @@ -76,6 +77,7 @@ class LanguageDataGenerator extends AbstractDataGenerator
'sc' => 'srd',
'sk' => 'slk',
'sq' => 'sqi',
'sr' => 'srp',
'sw' => 'swa',
'uz' => 'uzb',
'yi' => 'yid',
Expand Down Expand Up @@ -164,10 +166,13 @@ protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir)

private function generateAlpha2ToAlpha3Mapping(ArrayAccessibleResourceBundle $metadataBundle)
{
$aliases = $metadataBundle['languageAlias'];
// Data structure has changed in ICU 5.5 from "languageAlias" to "alias->language"
$aliases = $metadataBundle['languageAlias'] ?: $metadataBundle['alias']['language'];
$alpha2ToAlpha3 = array();

foreach ($aliases as $alias => $language) {
// $language is a string before ICU 5.5
$language = is_string($language) ? $language : $language['replacement'];
if (2 === strlen($language) && 3 === strlen($alias)) {
if (isset(self::$preferredAlpha2ToAlpha3Mapping[$language])) {
// Validate to prevent typos
Expand All @@ -181,12 +186,13 @@ private function generateAlpha2ToAlpha3Mapping(ArrayAccessibleResourceBundle $me
}

$alpha3 = self::$preferredAlpha2ToAlpha3Mapping[$language];
$alpha2 = is_string($aliases[$alpha3]) ? $aliases[$alpha3] : $aliases[$alpha3]['replacement'];

if ($language !== $aliases[$alpha3]) {
if ($language !== $alpha2) {
throw new RuntimeException(
'The statically set three-letter mapping '.$alpha3.' '.
'for the language code '.$language.' seems to be '.
'an alias for '.$aliases[$alpha3].'. Wrong mapping?'
'an alias for '.$alpha2.'. Wrong mapping?'
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Intl/Intl.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public static function getIcuDataVersion()
*/
public static function getIcuStubVersion()
{
return '51.2';
return '55.1';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class NumberFormatter

private static $enTextAttributes = array(
self::DECIMAL => array('', '', '-', '', '*', '', ''),
self::CURRENCY => array('¤', '', '(¤', ')', '*', ''),
self::CURRENCY => array('¤', '', '-¤', '', '*', ''),
);

/**
Expand Down Expand Up @@ -337,7 +337,7 @@ public function formatCurrency($value, $currency)

$ret = $symbol.$value;

return $negative ? '('.$ret.')' : $ret;
return $negative ? '-'.$ret : $ret;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Symfony/Component/Intl/Resources/bin/icu.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
51 = http://source.icu-project.org/repos/icu/icu/tags/release-51-2/source
52 = http://source.icu-project.org/repos/icu/icu/tags/release-52-1/source
53 = http://source.icu-project.org/repos/icu/icu/tags/release-53-1/source
54 = http://source.icu-project.org/repos/icu/icu/tags/release-54-rc/source
54 = http://source.icu-project.org/repos/icu/icu/tags/release-54-1/source
55 = http://source.icu-project.org/repos/icu/icu/tags/release-55-1/source
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.8.9",
"Version": "2.1.12.94",
"Names": {
"AED": [
"AED",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.8.19",
"Version": "2.1.11.68",
"Names": {
"NAD": [
"$",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.8.9",
"Version": "2.1.12.94",
"Names": {
"AED": [
"AED",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.8.9",
"Version": "2.1.12.94",
"Names": {
"ADP": [
"ADP",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.8.19",
"Version": "2.1.12.18",
"Names": {
"SDG": [
"SDG",
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Intl/Resources/data/currencies/az.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.8.9",
"Version": "2.1.12.94",
"Names": {
"ADP": [
"ADP",
Expand Down Expand Up @@ -339,7 +339,7 @@
],
"GBP": [
"£",
"Britaniya Funt Sterlinqi"
"Britaniya Funt"
],
"GEK": [
"GEK",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.6.69",
"Version": "2.1.10.34",
"Names": {
"AZN": [
"ман.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.7.39",
"Version": "2.1.10.93",
"Names": {
"AUD": [
"A$",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.8.9",
"Version": "2.1.12.94",
"Names": {
"ADP": [
"ADP",
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Intl/Resources/data/currencies/bm.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.6.69",
"Version": "2.1.10.42",
"Names": {
"AED": [
"AED",
Expand Down Expand Up @@ -71,7 +71,7 @@
],
"GBP": [
"£",
"angilɛ Livri Siterlingi"
"angilɛ Livri"
],
"GHC": [
"GHC",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.8.9",
"Version": "2.1.12.94",
"Names": {
"ADP": [
"ADP",
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Intl/Resources/data/currencies/br.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.7.39",
"Version": "2.1.10.93",
"Names": {
"ADP": [
"ADP",
Expand Down Expand Up @@ -315,7 +315,7 @@
],
"GBP": [
"£ RU",
"lur sterling Breizh-Veur"
"lur Breizh-Veur"
],
"GEL": [
"GEL",
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Intl/Resources/data/currencies/bs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.8.9",
"Version": "2.1.13.46",
"Names": {
"ADP": [
"ADP",
Expand Down Expand Up @@ -359,7 +359,7 @@
],
"GBP": [
"GBP",
"Britanska funta sterlinga"
"Britanska funta"
],
"GEK": [
"GEK",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.8.9",
"Version": "2.1.12.94",
"Names": {
"ADP": [
"ADP",
Expand Down Expand Up @@ -347,7 +347,7 @@
],
"GBP": [
"£",
"Британска фунта стерлинга"
"Британска фунта"
],
"GEK": [
"GEK",
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Intl/Resources/data/currencies/ca.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.8.9",
"Version": "2.1.12.94",
"Names": {
"ADP": [
"ADP",
Expand Down Expand Up @@ -384,7 +384,7 @@
],
"GBP": [
"£",
"lliura esterlina britànica"
"lliura britànica"
],
"GEK": [
"GEK",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.8.9",
"Version": "2.1.12.94",
"Names": {
"ADP": [
"ADP",
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Intl/Resources/data/currencies/cy.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.7.80",
"Version": "2.1.10.93",
"Names": {
"AED": [
"AED",
Expand Down Expand Up @@ -187,7 +187,7 @@
],
"GBP": [
"£",
"Punt Sterling Prydain"
"Punt Prydain"
],
"GEL": [
"GEL",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.9.62",
"Version": "2.1.12.94",
"Names": {
"ADP": [
"ADP",
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Intl/Resources/data/currencies/de.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.8.9",
"Version": "2.1.13.4",
"Names": {
"ADP": [
"ADP",
Expand Down Expand Up @@ -387,7 +387,7 @@
],
"GBP": [
"£",
"Britisches Pfund Sterling"
"Britisches Pfund"
],
"GEK": [
"GEK",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.8.21",
"Version": "2.1.11.70",
"Names": {
"BYR": [
"BYR",
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Intl/Resources/data/currencies/ee.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "2.1.8.9",
"Version": "2.1.12.94",
"Names": {
"ADP": [
"ADP",
Expand Down Expand Up @@ -387,7 +387,7 @@
],
"GBP": [
"£",
"britainga pound sterling"
"britainga pound"
],
"GEK": [
"GEK",
Expand Down
Loading