diff --git a/core/lib/Drupal/Component/Gettext/PoHeader.php b/core/lib/Drupal/Component/Gettext/PoHeader.php index 86f63a8..06ace2e 100644 --- a/core/lib/Drupal/Component/Gettext/PoHeader.php +++ b/core/lib/Drupal/Component/Gettext/PoHeader.php @@ -228,19 +228,17 @@ function parsePluralForms($pluralforms) { // For data compression we store the last position the array value // changes and store it as default. $element_stack = $this->parseArithmetic($plural); - $last = 0; $default = 0; if ($element_stack !== FALSE) { for ($i = 0; $i <= 199; $i++) { $plurals[$i] = $this->evaluatePlural($element_stack, $i); - // When the plural value changes, store position and value. - if (isset($plurals[$i-1]) && $plurals[$i] != $plurals[$i-1]) { - $last = $i; - $default = $plurals[$i]; - } } - $plurals = array_slice($plurals, 0, $last); + $default = $plurals[$i-1]; + $plurals = array_filter($plurals, function ($value) use ($default) { + return ($value != $default); + }); $plurals['default'] = $default; + return array($nplurals, $plurals); } else {