Skip to content

Commit

Permalink
minor #28977 [Intl] Update the ICU data to 63.1 (jakzal)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 3.4 branch (closes #28977).

Discussion
----------

[Intl] Update the ICU data to 63.1

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

http://site.icu-project.org/download/63

All tests are passing on the CI. I additionally run intl related tests (Form,Intl,Translation,Validator components) with ICU `63.1` on PHP `5.5`, `5.6`, `7.1`, `7.2`, `7.3-rc`.

Confirmed `@group intl-data` tests are passing with ICU `63.1` on PHP `5.5` and `7.2`.

Commits
-------

76bc6f0 [Intl] Update the ICU data to 63.1
  • Loading branch information
fabpot committed Oct 27, 2018
2 parents 4877d60 + 76bc6f0 commit c2478d4
Show file tree
Hide file tree
Showing 760 changed files with 13,605 additions and 3,721 deletions.
Expand Up @@ -120,8 +120,8 @@ public function transform($value)
throw new TransformationFailedException($formatter->getErrorMessage());
}

// Convert fixed spaces to normal ones
$value = str_replace("\xc2\xa0", ' ', $value);
// Convert non-breaking and narrow non-breaking spaces to normal ones
$value = str_replace(array("\xc2\xa0", "\xe2\x80\xaf"), ' ', $value);

return $value;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Intl/Intl.php
Expand Up @@ -235,7 +235,7 @@ public static function getIcuDataVersion()
*/
public static function getIcuStubVersion()
{
return '62.1';
return '63.1';
}

/**
Expand Down
35 changes: 20 additions & 15 deletions src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
Expand Up @@ -236,8 +236,8 @@ class NumberFormatter
);

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

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

$value = $this->formatNumber($value, $fractionDigits);

$ret = $symbol.$value;
// There's a non-breaking space after the currency code (i.e. CRC 100), but not if the currency has a symbol (i.e. £100).
$ret = $symbol.(mb_strlen($symbol, 'UTF-8') > 2 ? "\xc2\xa0" : '').$value;

return $negative ? '-'.$ret : $ret;
}
Expand Down Expand Up @@ -513,17 +514,20 @@ public function parse($value, $type = self::TYPE_DOUBLE, &$position = 0)
return false;
}

$groupSep = $this->getAttribute(self::GROUPING_USED) ? ',' : '';

// Any string before the numeric value causes error in the parsing
if (preg_match("/^-?(?:\.\d++|([\d{$groupSep}]++)(?:\.\d*+)?)/", $value, $matches)) {
// Any invalid number at the end of the string is removed.
// Only numbers and the fraction separator is expected in the string.
// If grouping is used, grouping separator also becomes a valid character.
$groupingMatch = $this->getAttribute(self::GROUPING_USED) ? '|(?P<grouping>\d++(,{1}\d+)++(\.\d*+)?)' : '';
if (preg_match("/^-?(?:\.\d++{$groupingMatch}|\d++(\.\d*+)?)/", $value, $matches)) {
$value = $matches[0];
$position = \strlen($value);
if ($error = $groupSep && isset($matches[1]) && !preg_match('/^\d{1,3}+(?:(?:,\d{3})++|\d*+)$/', $matches[1])) {
$position -= \strlen(preg_replace('/^\d{1,3}+(?:(?:,\d++)++|\d*+)/', '', $matches[1]));
// value is not valid if grouping is used, but digits are not grouped in groups of three
if ($error = isset($matches['grouping']) && !preg_match('/^-?(?:\d{1,3}+)?(?:(?:,\d{3})++|\d*+)(?:\.\d*+)?$/', $value)) {
// the position on error is 0 for positive and 1 for negative numbers
$position = 0 === strpos($value, '-') ? 1 : 0;
}
} else {
$error = 1;
$error = true;
$position = 0;
}

Expand Down Expand Up @@ -585,6 +589,10 @@ public function setAttribute($attr, $value)

if (self::$supportedAttributes['FRACTION_DIGITS'] == $attr) {
$value = $this->normalizeFractionDigitsValue($value);
if ($value < 0) {
// ignore negative values but do not raise an error
return true;
}
}

$this->attributes[$attr] = $value;
Expand Down Expand Up @@ -868,17 +876,14 @@ private function normalizeGroupingUsedValue($value)
}

/**
* Returns the normalized value for the FRACTION_DIGITS attribute. The value is converted to int and if negative,
* the returned value will be 0.
* Returns the normalized value for the FRACTION_DIGITS attribute.
*
* @param mixed $value The value to be normalized
*
* @return int The normalized value for the attribute
*/
private function normalizeFractionDigitsValue($value)
{
$value = (int) $value;

return (0 > $value) ? 0 : $value;
return (int) $value;
}
}
2 changes: 1 addition & 1 deletion src/Symfony/Component/Intl/Resources/bin/common.php
Expand Up @@ -55,7 +55,7 @@ function run($command)

function get_icu_version_from_genrb($genrb)
{
exec($genrb.' --version 2>&1', $output, $status);
exec($genrb.' --version - 2>&1', $output, $status);

if (0 !== $status) {
bailout($genrb.' failed.');
Expand Down
8 changes: 6 additions & 2 deletions src/Symfony/Component/Intl/Resources/data/currencies/af.json
@@ -1,5 +1,5 @@
{
"Version": "2.1.41.97",
"Version": "2.1.43.65",
"Names": {
"AED": [
"AED",
Expand Down Expand Up @@ -183,7 +183,7 @@
],
"EUR": [
"",
"Euro"
"euro"
],
"FJD": [
"FJD",
Expand Down Expand Up @@ -629,6 +629,10 @@
"VEF",
"Venezolaanse bolivar"
],
"VES": [
"VES",
"Venezolaanse Bolívar"
],
"VND": [
"",
"Viëtnamese dong"
Expand Down
12 changes: 8 additions & 4 deletions src/Symfony/Component/Intl/Resources/data/currencies/am.json
@@ -1,5 +1,5 @@
{
"Version": "2.1.41.97",
"Version": "2.1.43.65",
"Names": {
"AED": [
"AED",
Expand Down Expand Up @@ -503,11 +503,11 @@
],
"SDG": [
"SDG",
"የሱዳን ዲናር"
"የሱዳን ፓውንድ"
],
"SDP": [
"SDP",
"የሱዳን ፓውንድ"
"የሱዳን ፓውንድ (1957–1998)"
],
"SEK": [
"SEK",
Expand Down Expand Up @@ -611,7 +611,11 @@
],
"VEF": [
"VEF",
"የቬንዝዌላ ቦሊቫር"
"የቬንዝዌላ ቦሊቫር (2008–2018)"
],
"VES": [
"VES",
"የቬንዝዌላ-ቦሊቫር"
],
"VND": [
"",
Expand Down
12 changes: 8 additions & 4 deletions src/Symfony/Component/Intl/Resources/data/currencies/ar.json
@@ -1,5 +1,5 @@
{
"Version": "2.1.41.97",
"Version": "2.1.43.50",
"Names": {
"ADP": [
"ADP",
Expand Down Expand Up @@ -235,7 +235,7 @@
],
"CVE": [
"CVE",
"اسكودو الرأس الخضراء"
"اسكودو الرأس الأخضر"
],
"CYP": [
"CYP",
Expand Down Expand Up @@ -566,11 +566,11 @@
"باتاكا ماكاوي"
],
"MRO": [
"أ.م.‏",
"MRO",
"أوقية موريتانية - 1973-2017"
],
"MRU": [
"MRU",
"أ.م.",
"أوقية موريتانية"
],
"MTL": [
Expand Down Expand Up @@ -899,6 +899,10 @@
],
"VEF": [
"VEF",
"بوليفار فنزويلي - 2008–2018"
],
"VES": [
"VES",
"بوليفار فنزويلي"
],
"VND": [
Expand Down
10 changes: 9 additions & 1 deletion src/Symfony/Component/Intl/Resources/data/currencies/as.json
@@ -1,5 +1,5 @@
{
"Version": "2.1.41.97",
"Version": "2.1.43.94",
"Names": {
"AED": [
"AED",
Expand Down Expand Up @@ -585,8 +585,16 @@
"UZS",
"উজবেকিস্তানী ছোম"
],
"VEB": [
"VEB",
"ভেনিজুৱেলান বলিভাৰ (1871–2008)"
],
"VEF": [
"VEF",
"ভেনিজুৱেলান বলিভাৰ (2008–2018)"
],
"VES": [
"VES",
"ভেনিজুৱেলান বলিভাৰ"
],
"VND": [
Expand Down
6 changes: 5 additions & 1 deletion src/Symfony/Component/Intl/Resources/data/currencies/az.json
@@ -1,5 +1,5 @@
{
"Version": "2.1.41.97",
"Version": "2.1.44.53",
"Names": {
"ADP": [
"ADP",
Expand Down Expand Up @@ -955,6 +955,10 @@
],
"VEF": [
"VEF",
"Venesuela Bolivarı (2008–2018)"
],
"VES": [
"VES",
"Venesuela Bolivarı"
],
"VND": [
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.38.69",
"Version": "2.1.44.53",
"Names": {
"AZN": [
"",
Expand Down
6 changes: 5 additions & 1 deletion src/Symfony/Component/Intl/Resources/data/currencies/be.json
@@ -1,5 +1,5 @@
{
"Version": "2.1.41.97",
"Version": "2.1.43.65",
"Names": {
"AED": [
"AED",
Expand Down Expand Up @@ -591,6 +591,10 @@
],
"VEF": [
"VEF",
"венесуальскі балівар (2008–2018)"
],
"VES": [
"VES",
"венесуальскі балівар"
],
"VND": [
Expand Down
6 changes: 5 additions & 1 deletion src/Symfony/Component/Intl/Resources/data/currencies/bg.json
@@ -1,5 +1,5 @@
{
"Version": "2.1.41.97",
"Version": "2.1.43.94",
"Names": {
"ADP": [
"ADP",
Expand Down Expand Up @@ -949,6 +949,10 @@
"VEF",
"Венецуелски боливар"
],
"VES": [
"VES",
"Венецуелски боливар (VES)"
],
"VND": [
"VND",
"Виетнамски донг"
Expand Down
6 changes: 5 additions & 1 deletion src/Symfony/Component/Intl/Resources/data/currencies/bn.json
@@ -1,5 +1,5 @@
{
"Version": "2.1.41.97",
"Version": "2.1.44.91",
"Names": {
"ADP": [
"ADP",
Expand Down Expand Up @@ -971,6 +971,10 @@
],
"VEF": [
"VEF",
"ভেনিজুয়েলীয় বলিভার (২০০৮–২০১৮)"
],
"VES": [
"VES",
"ভেনিজুয়েলীয় বলিভার"
],
"VND": [
Expand Down
6 changes: 5 additions & 1 deletion src/Symfony/Component/Intl/Resources/data/currencies/br.json
@@ -1,5 +1,5 @@
{
"Version": "2.1.41.97",
"Version": "2.1.44.91",
"Names": {
"ADP": [
"ADP",
Expand Down Expand Up @@ -1039,6 +1039,10 @@
],
"VEF": [
"VEF",
"bolivar Venezuela (2008–2018)"
],
"VES": [
"VES",
"bolivar Venezuela"
],
"VND": [
Expand Down
8 changes: 6 additions & 2 deletions src/Symfony/Component/Intl/Resources/data/currencies/bs.json
@@ -1,5 +1,5 @@
{
"Version": "2.1.41.97",
"Version": "2.1.44.88",
"Names": {
"ADP": [
"ADP",
Expand Down Expand Up @@ -1003,7 +1003,11 @@
],
"VEF": [
"VEF",
"Venecuelanski bolivar"
"venecuelanski bolivar (2008–2018)"
],
"VES": [
"VES",
"venecuelanski bolivar"
],
"VND": [
"",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.41.97",
"Version": "2.1.41.34",
"Names": {
"ADP": [
"ADP",
Expand Down Expand Up @@ -971,6 +971,10 @@
],
"VEF": [
"VEF",
"Венецуелански боливар (2008–2018)"
],
"VES": [
"VES",
"Венецуелански боливар"
],
"VND": [
Expand Down

0 comments on commit c2478d4

Please sign in to comment.