Issue #2309737 by rpayanm, hussainweb, max-kuzomko, herom, millerbennett, ianthomas_uk, quietone, Sutharsan, sumitmadan, toddmbloom: Remove deprecated format_plural usage
							parent
							
								
									f14ec03536
								
							
						
					
					
						commit
						aff95777ed
					
				| 
						 | 
					@ -393,12 +393,12 @@ function format_xml_elements($array) {
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * For example:
 | 
					 * For example:
 | 
				
			||||||
 * @code
 | 
					 * @code
 | 
				
			||||||
 *   $output = format_plural($node->comment_count, '1 comment', '@count comments');
 | 
					 *   $output = \Drupal::translation()->formatPlural($node->comment_count, '1 comment', '@count comments');
 | 
				
			||||||
 * @endcode
 | 
					 * @endcode
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Example with additional replacements:
 | 
					 * Example with additional replacements:
 | 
				
			||||||
 * @code
 | 
					 * @code
 | 
				
			||||||
 *   $output = format_plural($update_count,
 | 
					 *   $output = \Drupal::translation()->formatPlural($update_count,
 | 
				
			||||||
 *     'Changed the content type of 1 post from %old-type to %new-type.',
 | 
					 *     'Changed the content type of 1 post from %old-type to %new-type.',
 | 
				
			||||||
 *     'Changed the content type of @count posts from %old-type to %new-type.',
 | 
					 *     'Changed the content type of @count posts from %old-type to %new-type.',
 | 
				
			||||||
 *     array('%old-type' => $info->old_type, '%new-type' => $info->new_type));
 | 
					 *     array('%old-type' => $info->old_type, '%new-type' => $info->new_type));
 | 
				
			||||||
| 
						 | 
					@ -451,7 +451,7 @@ function format_plural($count, $singular, $plural, array $args = array(), array
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
function format_size($size, $langcode = NULL) {
 | 
					function format_size($size, $langcode = NULL) {
 | 
				
			||||||
  if ($size < Bytes::KILOBYTE) {
 | 
					  if ($size < Bytes::KILOBYTE) {
 | 
				
			||||||
    return format_plural($size, '1 byte', '@count bytes', array(), array('langcode' => $langcode));
 | 
					    return \Drupal::translation()->formatPlural($size, '1 byte', '@count bytes', array(), array('langcode' => $langcode));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
    $size = $size / Bytes::KILOBYTE; // Convert bytes to kilobytes.
 | 
					    $size = $size / Bytes::KILOBYTE; // Convert bytes to kilobytes.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -617,7 +617,7 @@ function template_preprocess_form_element_label(&$variables) {
 | 
				
			||||||
 *   // The 'success' parameter means no fatal PHP errors were detected. All
 | 
					 *   // The 'success' parameter means no fatal PHP errors were detected. All
 | 
				
			||||||
 *   // other error management should be handled using 'results'.
 | 
					 *   // other error management should be handled using 'results'.
 | 
				
			||||||
 *   if ($success) {
 | 
					 *   if ($success) {
 | 
				
			||||||
 *     $message = format_plural(count($results), 'One post processed.', '@count posts processed.');
 | 
					 *     $message = \Drupal::translation()->formatPlural(count($results), 'One post processed.', '@count posts processed.');
 | 
				
			||||||
 *   }
 | 
					 *   }
 | 
				
			||||||
 *   else {
 | 
					 *   else {
 | 
				
			||||||
 *     $message = t('Finished with an error.');
 | 
					 *     $message = t('Finished with an error.');
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,7 +41,7 @@ class InfoParser implements InfoParserInterface {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        $missing_keys = array_diff($this->getRequiredKeys(), array_keys(static::$parsedInfos[$filename]));
 | 
					        $missing_keys = array_diff($this->getRequiredKeys(), array_keys(static::$parsedInfos[$filename]));
 | 
				
			||||||
        if (!empty($missing_keys)) {
 | 
					        if (!empty($missing_keys)) {
 | 
				
			||||||
          $message = format_plural(count($missing_keys), 'Missing required key (!missing_keys) in !file.', 'Missing required keys (!missing_keys) in !file.', array('!missing_keys' => implode(', ', $missing_keys), '!file' => $filename));
 | 
					          $message = String::format('Missing required keys (!missing_keys) in !file.', array('!missing_keys' => implode(', ', $missing_keys), '!file' => $filename));
 | 
				
			||||||
          throw new InfoParserException($message);
 | 
					          throw new InfoParserException($message);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (isset(static::$parsedInfos[$filename]['version']) && static::$parsedInfos[$filename]['version'] === 'VERSION') {
 | 
					        if (isset(static::$parsedInfos[$filename]['version']) && static::$parsedInfos[$filename]['version'] === 'VERSION') {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -77,8 +77,8 @@ abstract class NumericFormatterBase extends FormatterBase {
 | 
				
			||||||
      if ($this->getSetting('prefix_suffix')) {
 | 
					      if ($this->getSetting('prefix_suffix')) {
 | 
				
			||||||
        $prefixes = isset($settings['prefix']) ? array_map(array($this, 'fieldFilterXss'), explode('|', $settings['prefix'])) : array('');
 | 
					        $prefixes = isset($settings['prefix']) ? array_map(array($this, 'fieldFilterXss'), explode('|', $settings['prefix'])) : array('');
 | 
				
			||||||
        $suffixes = isset($settings['suffix']) ? array_map(array($this, 'fieldFilterXss'), explode('|', $settings['suffix'])) : array('');
 | 
					        $suffixes = isset($settings['suffix']) ? array_map(array($this, 'fieldFilterXss'), explode('|', $settings['suffix'])) : array('');
 | 
				
			||||||
        $prefix = (count($prefixes) > 1) ? format_plural($item->value, $prefixes[0], $prefixes[1]) : $prefixes[0];
 | 
					        $prefix = (count($prefixes) > 1) ? $this->formatPlural($item->value, $prefixes[0], $prefixes[1]) : $prefixes[0];
 | 
				
			||||||
        $suffix = (count($suffixes) > 1) ? format_plural($item->value, $suffixes[0], $suffixes[1]) : $suffixes[0];
 | 
					        $suffix = (count($suffixes) > 1) ? $this->formatPlural($item->value, $suffixes[0], $suffixes[1]) : $suffixes[0];
 | 
				
			||||||
        $output = $prefix . $output . $suffix;
 | 
					        $output = $prefix . $output . $suffix;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      // Output the raw value in a content attribute if the text of the HTML
 | 
					      // Output the raw value in a content attribute if the text of the HTML
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,8 +12,8 @@ namespace Drupal\Core\StringTranslation;
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Using this trait will add t() and formatPlural() methods to the class. These
 | 
					 * Using this trait will add t() and formatPlural() methods to the class. These
 | 
				
			||||||
 * must be used for every translatable string, similar to how procedural code
 | 
					 * must be used for every translatable string, similar to how procedural code
 | 
				
			||||||
 * must use the global functions t() and format_plural(). This allows string
 | 
					 * must use the global functions t() and \Drupal::translation()->formatPlural().
 | 
				
			||||||
 * extractor tools to find translatable strings.
 | 
					 * This allows string extractor tools to find translatable strings.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * If the class is capable of injecting services from the container, it should
 | 
					 * If the class is capable of injecting services from the container, it should
 | 
				
			||||||
 * inject the 'string_translation' service and assign it to
 | 
					 * inject the 'string_translation' service and assign it to
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -51,7 +51,7 @@ class TwigNodeTrans extends \Twig_Node {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Start writing with the function to be called.
 | 
					    // Start writing with the function to be called.
 | 
				
			||||||
    $compiler->write('echo ' . (empty($plural) ? 't' : 'format_plural') . '(');
 | 
					    $compiler->write('echo ' . (empty($plural) ? 't' : '\Drupal::translation()->formatPlural') . '(');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Move the count to the beginning of the parameters list.
 | 
					    // Move the count to the beginning of the parameters list.
 | 
				
			||||||
    if (!empty($plural)) {
 | 
					    if (!empty($plural)) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,7 +41,7 @@ class DrupalTranslator implements TranslatorInterface {
 | 
				
			||||||
    if (!isset($ids[1])) {
 | 
					    if (!isset($ids[1])) {
 | 
				
			||||||
      throw new \InvalidArgumentException(sprintf('The message "%s" cannot be pluralized, because it is missing a plural (e.g. "There is one apple|There are @count apples").', $id));
 | 
					      throw new \InvalidArgumentException(sprintf('The message "%s" cannot be pluralized, because it is missing a plural (e.g. "There is one apple|There are @count apples").', $id));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return format_plural($number, $ids[0], $ids[1], $this->processParameters($parameters), $this->getOptions($domain, $locale));
 | 
					    return \Drupal::translation()->formatPlural($number, $ids[0], $ids[1], $this->processParameters($parameters), $this->getOptions($domain, $locale));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -336,8 +336,9 @@ if (window.jQuery) {
 | 
				
			||||||
   * Drupal.t() is called by this function, make sure not to pass
 | 
					   * Drupal.t() is called by this function, make sure not to pass
 | 
				
			||||||
   * already-localized strings to it.
 | 
					   * already-localized strings to it.
 | 
				
			||||||
   *
 | 
					   *
 | 
				
			||||||
   * See the documentation of the server-side format_plural() function for
 | 
					   * See the documentation of the server-side
 | 
				
			||||||
   * further details.
 | 
					   * \Drupal\Core\StringTranslation\TranslationInterface::formatPlural()
 | 
				
			||||||
 | 
					   * function for more details.
 | 
				
			||||||
   *
 | 
					   *
 | 
				
			||||||
   * @param {Number} count
 | 
					   * @param {Number} count
 | 
				
			||||||
   *   The item count to display.
 | 
					   *   The item count to display.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -150,7 +150,7 @@ class DefaultProcessor extends AggregatorPluginSettingsBase implements Processor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $lengths = array(0, 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000);
 | 
					    $lengths = array(0, 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000);
 | 
				
			||||||
    $options = array_map(function($length) {
 | 
					    $options = array_map(function($length) {
 | 
				
			||||||
      return ($length == 0) ? t('Unlimited') : format_plural($length, '1 character', '@count characters');
 | 
					      return ($length == 0) ? t('Unlimited') : $this->formatPlural($length, '1 character', '@count characters');
 | 
				
			||||||
    }, array_combine($lengths, $lengths));
 | 
					    }, array_combine($lengths, $lengths));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $form['processors'][$info['id']]['aggregator_teaser_length'] = array(
 | 
					    $form['processors'][$info['id']]['aggregator_teaser_length'] = array(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,7 +44,7 @@ class BlockContentDeleteForm extends ContentEntityConfirmFormBase {
 | 
				
			||||||
    $instances = $this->entity->getInstances();
 | 
					    $instances = $this->entity->getInstances();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $form['message'] = array(
 | 
					    $form['message'] = array(
 | 
				
			||||||
      '#markup' => format_plural(count($instances), 'This will also remove 1 placed block instance.', 'This will also remove @count placed block instances.'),
 | 
					      '#markup' => $this->formatPlural(count($instances), 'This will also remove 1 placed block instance.', 'This will also remove @count placed block instances.'),
 | 
				
			||||||
      '#access' => !empty($instances),
 | 
					      '#access' => !empty($instances),
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,7 +71,7 @@ class BlockContentTypeDeleteForm extends EntityConfirmFormBase {
 | 
				
			||||||
  public function buildForm(array $form, FormStateInterface $form_state) {
 | 
					  public function buildForm(array $form, FormStateInterface $form_state) {
 | 
				
			||||||
    $blocks = $this->queryFactory->get('block_content')->condition('type', $this->entity->id())->execute();
 | 
					    $blocks = $this->queryFactory->get('block_content')->condition('type', $this->entity->id())->execute();
 | 
				
			||||||
    if (!empty($blocks)) {
 | 
					    if (!empty($blocks)) {
 | 
				
			||||||
      $caption = '<p>' . format_plural(count($blocks), '%label is used by 1 custom block on your site. You can not remove this block type until you have removed all of the %label blocks.', '%label is used by @count custom blocks on your site. You may not remove %label until you have removed all of the %label custom blocks.', array('%label' => $this->entity->label())) . '</p>';
 | 
					      $caption = '<p>' . $this->formatPlural(count($blocks), '%label is used by 1 custom block on your site. You can not remove this block type until you have removed all of the %label blocks.', '%label is used by @count custom blocks on your site. You may not remove %label until you have removed all of the %label custom blocks.', array('%label' => $this->entity->label())) . '</p>';
 | 
				
			||||||
      $form['description'] = array('#markup' => $caption);
 | 
					      $form['description'] = array('#markup' => $caption);
 | 
				
			||||||
      return $form;
 | 
					      return $form;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -184,7 +184,7 @@ class BlockContentCreationTest extends BlockContentTestBase {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Delete the block.
 | 
					    // Delete the block.
 | 
				
			||||||
    $this->drupalGet('block/1/delete');
 | 
					    $this->drupalGet('block/1/delete');
 | 
				
			||||||
    $this->assertText(format_plural(1, 'This will also remove 1 placed block instance.', 'This will also remove @count placed block instance.'));
 | 
					    $this->assertText(\Drupal::translation()->formatPlural(1, 'This will also remove 1 placed block instance.', 'This will also remove @count placed block instance.'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $this->drupalPostForm(NULL, array(), 'Delete');
 | 
					    $this->drupalPostForm(NULL, array(), 'Delete');
 | 
				
			||||||
    $this->assertRaw(t('Custom block %name has been deleted.', array('%name' => $edit['info[0][value]'])));
 | 
					    $this->assertRaw(t('Custom block %name has been deleted.', array('%name' => $edit['info[0][value]'])));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -530,7 +530,7 @@ function comment_node_search_result(EntityInterface $node) {
 | 
				
			||||||
  // Do not make a string if there are no comment fields, or no comments exist
 | 
					  // Do not make a string if there are no comment fields, or no comments exist
 | 
				
			||||||
  // or all comment fields are hidden.
 | 
					  // or all comment fields are hidden.
 | 
				
			||||||
  if ($comments > 0 || $open) {
 | 
					  if ($comments > 0 || $open) {
 | 
				
			||||||
    return array('comment' => format_plural($comments, '1 comment', '@count comments'));
 | 
					    return array('comment' => \Drupal::translation()->formatPlural($comments, '1 comment', '@count comments'));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -122,7 +122,7 @@ class ConfirmDeleteMultiple extends ConfirmFormBase {
 | 
				
			||||||
      $this->commentStorage->delete($this->comments);
 | 
					      $this->commentStorage->delete($this->comments);
 | 
				
			||||||
      $count = count($form_state->getValue('comments'));
 | 
					      $count = count($form_state->getValue('comments'));
 | 
				
			||||||
      $this->logger('content')->notice('Deleted @count comments.', array('@count' => $count));
 | 
					      $this->logger('content')->notice('Deleted @count comments.', array('@count' => $count));
 | 
				
			||||||
      drupal_set_message(format_plural($count, 'Deleted 1 comment.', 'Deleted @count comments.'));
 | 
					      drupal_set_message($this->formatPlural($count, 'Deleted 1 comment.', 'Deleted @count comments.'));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    $form_state->setRedirectUrl($this->getCancelUrl());
 | 
					    $form_state->setRedirectUrl($this->getCancelUrl());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -208,7 +208,7 @@ class CommentNonNodeTest extends WebTestBase {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ($operation == 'delete') {
 | 
					    if ($operation == 'delete') {
 | 
				
			||||||
      $this->drupalPostForm(NULL, array(), t('Delete comments'));
 | 
					      $this->drupalPostForm(NULL, array(), t('Delete comments'));
 | 
				
			||||||
      $this->assertRaw(format_plural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), format_string('Operation "@operation" was performed on comment.', array('@operation' => $operation)));
 | 
					      $this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), format_string('Operation "@operation" was performed on comment.', array('@operation' => $operation)));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
      $this->assertText(t('The update has been performed.'), format_string('Operation "@operation" was performed on comment.', array('@operation' => $operation)));
 | 
					      $this->assertText(t('The update has been performed.'), format_string('Operation "@operation" was performed on comment.', array('@operation' => $operation)));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -345,7 +345,7 @@ abstract class CommentTestBase extends WebTestBase {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ($operation == 'delete') {
 | 
					    if ($operation == 'delete') {
 | 
				
			||||||
      $this->drupalPostForm(NULL, array(), t('Delete comments'));
 | 
					      $this->drupalPostForm(NULL, array(), t('Delete comments'));
 | 
				
			||||||
      $this->assertRaw(format_plural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), format_string('Operation "@operation" was performed on comment.', array('@operation' => $operation)));
 | 
					      $this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), format_string('Operation "@operation" was performed on comment.', array('@operation' => $operation)));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
      $this->assertText(t('The update has been performed.'), format_string('Operation "@operation" was performed on comment.', array('@operation' => $operation)));
 | 
					      $this->assertText(t('The update has been performed.'), format_string('Operation "@operation" was performed on comment.', array('@operation' => $operation)));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -239,19 +239,19 @@ class ConfigSync extends FormBase {
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        switch ($config_change_type) {
 | 
					        switch ($config_change_type) {
 | 
				
			||||||
          case 'create':
 | 
					          case 'create':
 | 
				
			||||||
            $form[$collection][$config_change_type]['heading']['#value'] = format_plural(count($config_names), '@count new', '@count new');
 | 
					            $form[$collection][$config_change_type]['heading']['#value'] = $this->formatPlural(count($config_names), '@count new', '@count new');
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          case 'update':
 | 
					          case 'update':
 | 
				
			||||||
            $form[$collection][$config_change_type]['heading']['#value'] = format_plural(count($config_names), '@count changed', '@count changed');
 | 
					            $form[$collection][$config_change_type]['heading']['#value'] = $this->formatPlural(count($config_names), '@count changed', '@count changed');
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          case 'delete':
 | 
					          case 'delete':
 | 
				
			||||||
            $form[$collection][$config_change_type]['heading']['#value'] = format_plural(count($config_names), '@count removed', '@count removed');
 | 
					            $form[$collection][$config_change_type]['heading']['#value'] = $this->formatPlural(count($config_names), '@count removed', '@count removed');
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          case 'rename':
 | 
					          case 'rename':
 | 
				
			||||||
            $form[$collection][$config_change_type]['heading']['#value'] = format_plural(count($config_names), '@count renamed', '@count renamed');
 | 
					            $form[$collection][$config_change_type]['heading']['#value'] = $this->formatPlural(count($config_names), '@count renamed', '@count renamed');
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        $form[$collection][$config_change_type]['list'] = array(
 | 
					        $form[$collection][$config_change_type]['list'] = array(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -175,7 +175,7 @@ function template_preprocess_file_upload_help(&$variables) {
 | 
				
			||||||
      $descriptions[] = t('Unlimited number of files can be uploaded to this field.');
 | 
					      $descriptions[] = t('Unlimited number of files can be uploaded to this field.');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
      $descriptions[] = format_plural($cardinality, 'One file only.', 'Maximum @count files.');
 | 
					      $descriptions[] = \Drupal::translation()->formatPlural($cardinality, 'One file only.', 'Maximum @count files.');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (isset($upload_validators['file_validate_size'])) {
 | 
					  if (isset($upload_validators['file_validate_size'])) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,7 +80,7 @@ abstract class FileManagedTestBase extends WebTestBase {
 | 
				
			||||||
        $message = format_string('hook_file_@name was called correctly.', array('@name' => $hook));
 | 
					        $message = format_string('hook_file_@name was called correctly.', array('@name' => $hook));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      elseif ($expected_count == 0) {
 | 
					      elseif ($expected_count == 0) {
 | 
				
			||||||
        $message = format_plural($actual_count, 'hook_file_@name was not expected to be called but was actually called once.', 'hook_file_@name was not expected to be called but was actually called @count times.', array('@name' => $hook, '@count' => $actual_count));
 | 
					        $message = \Drupal::translation()->formatPlural($actual_count, 'hook_file_@name was not expected to be called but was actually called once.', 'hook_file_@name was not expected to be called but was actually called @count times.', array('@name' => $hook, '@count' => $actual_count));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      else {
 | 
					      else {
 | 
				
			||||||
        $message = format_string('hook_file_@name was expected to be called %expected times but was called %actual times.', array('@name' => $hook, '%expected' => $expected_count, '%actual' => $actual_count));
 | 
					        $message = format_string('hook_file_@name was expected to be called %expected times but was called %actual times.', array('@name' => $hook, '%expected' => $expected_count, '%actual' => $actual_count));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -92,7 +92,7 @@ abstract class FileManagedUnitTestBase extends KernelTestBase {
 | 
				
			||||||
        $message = format_string('hook_file_@name was called correctly.', array('@name' => $hook));
 | 
					        $message = format_string('hook_file_@name was called correctly.', array('@name' => $hook));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      elseif ($expected_count == 0) {
 | 
					      elseif ($expected_count == 0) {
 | 
				
			||||||
        $message = format_plural($actual_count, 'hook_file_@name was not expected to be called but was actually called once.', 'hook_file_@name was not expected to be called but was actually called @count times.', array('@name' => $hook, '@count' => $actual_count));
 | 
					        $message = \Drupal::translation()->formatPlural($actual_count, 'hook_file_@name was not expected to be called but was actually called once.', 'hook_file_@name was not expected to be called but was actually called @count times.', array('@name' => $hook, '@count' => $actual_count));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      else {
 | 
					      else {
 | 
				
			||||||
        $message = format_string('hook_file_@name was expected to be called %expected times but was called %actual times.', array('@name' => $hook, '%expected' => $expected_count, '%actual' => $actual_count));
 | 
					        $message = format_string('hook_file_@name was expected to be called %expected times but was called %actual times.', array('@name' => $hook, '%expected' => $expected_count, '%actual' => $actual_count));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -501,7 +501,7 @@ function template_preprocess_forums(&$variables) {
 | 
				
			||||||
          $page_number = \Drupal::entityManager()->getStorage('comment')
 | 
					          $page_number = \Drupal::entityManager()->getStorage('comment')
 | 
				
			||||||
            ->getNewCommentPageNumber($topic->comment_count, $topic->new_replies, $topic, 'comment_forum');
 | 
					            ->getNewCommentPageNumber($topic->comment_count, $topic->new_replies, $topic, 'comment_forum');
 | 
				
			||||||
          $query = $page_number ? array('page' => $page_number) : NULL;
 | 
					          $query = $page_number ? array('page' => $page_number) : NULL;
 | 
				
			||||||
          $variables['topics'][$id]->new_text = format_plural($topic->new_replies, '1 new post<span class="visually-hidden"> in topic %title</span>', '@count new posts<span class="visually-hidden"> in topic %title</span>', array('%title' => $variables['topics'][$id]->label()));
 | 
					          $variables['topics'][$id]->new_text = \Drupal::translation()->formatPlural($topic->new_replies, '1 new post<span class="visually-hidden"> in topic %title</span>', '@count new posts<span class="visually-hidden"> in topic %title</span>', array('%title' => $variables['topics'][$id]->label()));
 | 
				
			||||||
          $variables['topics'][$id]->new_url = \Drupal::url('entity.node.canonical', ['node' => $topic->id()], ['query' => $query, 'fragment' => 'new']);
 | 
					          $variables['topics'][$id]->new_url = \Drupal::url('entity.node.canonical', ['node' => $topic->id()], ['query' => $query, 'fragment' => 'new']);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -583,7 +583,7 @@ function template_preprocess_forum_list(&$variables) {
 | 
				
			||||||
    if ($user->isAuthenticated()) {
 | 
					    if ($user->isAuthenticated()) {
 | 
				
			||||||
      $variables['forums'][$id]->new_topics = \Drupal::service('forum_manager')->unreadTopics($forum->id(), $user->id());
 | 
					      $variables['forums'][$id]->new_topics = \Drupal::service('forum_manager')->unreadTopics($forum->id(), $user->id());
 | 
				
			||||||
      if ($variables['forums'][$id]->new_topics) {
 | 
					      if ($variables['forums'][$id]->new_topics) {
 | 
				
			||||||
        $variables['forums'][$id]->new_text = format_plural($variables['forums'][$id]->new_topics, '1 new post<span class="visually-hidden"> in forum %title</span>', '@count new posts<span class="visually-hidden"> in forum %title</span>', array('%title' => $variables['forums'][$id]->label()));
 | 
					        $variables['forums'][$id]->new_text = \Drupal::translation()->formatPlural($variables['forums'][$id]->new_topics, '1 new post<span class="visually-hidden"> in forum %title</span>', '@count new posts<span class="visually-hidden"> in forum %title</span>', array('%title' => $variables['forums'][$id]->label()));
 | 
				
			||||||
        $variables['forums'][$id]->new_url = \Drupal::url('forum.page', ['taxonomy_term' => $forum->id()], ['fragment' => 'new']);
 | 
					        $variables['forums'][$id]->new_url = \Drupal::url('forum.page', ['taxonomy_term' => $forum->id()], ['fragment' => 'new']);
 | 
				
			||||||
        $variables['forums'][$id]->icon_class = 'new';
 | 
					        $variables['forums'][$id]->icon_class = 'new';
 | 
				
			||||||
        $variables['forums'][$id]->icon_title = t('New posts');
 | 
					        $variables['forums'][$id]->icon_title = t('New posts');
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -184,7 +184,7 @@ class ForumTest extends WebTestBase {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Verify the number of unread topics.
 | 
					    // Verify the number of unread topics.
 | 
				
			||||||
    $unread_topics = $this->container->get('forum_manager')->unreadTopics($this->forum['tid'], $this->edit_any_topics_user->id());
 | 
					    $unread_topics = $this->container->get('forum_manager')->unreadTopics($this->forum['tid'], $this->edit_any_topics_user->id());
 | 
				
			||||||
    $unread_topics = format_plural($unread_topics, '1 new post', '@count new posts');
 | 
					    $unread_topics = \Drupal::translation()->formatPlural($unread_topics, '1 new post', '@count new posts');
 | 
				
			||||||
    $xpath = $this->buildXPathQuery('//tr[@id=:forum]//td[@class="topics"]//a', $forum_arg);
 | 
					    $xpath = $this->buildXPathQuery('//tr[@id=:forum]//td[@class="topics"]//a', $forum_arg);
 | 
				
			||||||
    $this->assertFieldByXPath($xpath, $unread_topics, 'Number of unread topics found.');
 | 
					    $this->assertFieldByXPath($xpath, $unread_topics, 'Number of unread topics found.');
 | 
				
			||||||
    // Verify that the forum name is in the unread topics text.
 | 
					    // Verify that the forum name is in the unread topics text.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -94,15 +94,15 @@ function locale_translation_batch_status_finished($success, $results) {
 | 
				
			||||||
  if ($success) {
 | 
					  if ($success) {
 | 
				
			||||||
    if (isset($results['failed_files'])) {
 | 
					    if (isset($results['failed_files'])) {
 | 
				
			||||||
      if (\Drupal::moduleHandler()->moduleExists('dblog') && \Drupal::currentUser()->hasPermission('access site reports')) {
 | 
					      if (\Drupal::moduleHandler()->moduleExists('dblog') && \Drupal::currentUser()->hasPermission('access site reports')) {
 | 
				
			||||||
        $message = format_plural(count($results['failed_files']), 'One translation file could not be checked. <a href="@url">See the log</a> for details.', '@count translation files could not be checked. <a href="@url">See the log</a> for details.', array('@url' => \Drupal::url('dblog.overview')));
 | 
					        $message = \Drupal::translation()->formatPlural(count($results['failed_files']), 'One translation file could not be checked. <a href="@url">See the log</a> for details.', '@count translation files could not be checked. <a href="@url">See the log</a> for details.', array('@url' => \Drupal::url('dblog.overview')));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      else {
 | 
					      else {
 | 
				
			||||||
        $message = format_plural(count($results['failed_files']), 'One translation files could not be checked. See the log for details.', '@count translation files could not be checked. See the log for details.');
 | 
					        $message = \Drupal::translation()->formatPlural(count($results['failed_files']), 'One translation files could not be checked. See the log for details.', '@count translation files could not be checked. See the log for details.');
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      drupal_set_message($message, 'error');
 | 
					      drupal_set_message($message, 'error');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (isset($results['files'])) {
 | 
					    if (isset($results['files'])) {
 | 
				
			||||||
      drupal_set_message(format_plural(
 | 
					      drupal_set_message(\Drupal::translation()->formatPlural(
 | 
				
			||||||
        count($results['files']),
 | 
					        count($results['files']),
 | 
				
			||||||
        'Checked available interface translation updates for one project.',
 | 
					        'Checked available interface translation updates for one project.',
 | 
				
			||||||
        'Checked available interface translation updates for @count projects.'
 | 
					        'Checked available interface translation updates for @count projects.'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -359,10 +359,10 @@ function locale_translate_batch_finished($success, array $results) {
 | 
				
			||||||
    $additions = $updates = $deletes = $skips = $config = 0;
 | 
					    $additions = $updates = $deletes = $skips = $config = 0;
 | 
				
			||||||
    if (isset($results['failed_files'])) {
 | 
					    if (isset($results['failed_files'])) {
 | 
				
			||||||
      if (\Drupal::moduleHandler()->moduleExists('dblog') && \Drupal::currentUser()->hasPermission('access site reports')) {
 | 
					      if (\Drupal::moduleHandler()->moduleExists('dblog') && \Drupal::currentUser()->hasPermission('access site reports')) {
 | 
				
			||||||
        $message = format_plural(count($results['failed_files']), 'One translation file could not be imported. <a href="@url">See the log</a> for details.', '@count translation files could not be imported. <a href="@url">See the log</a> for details.', array('@url' => \Drupal::url('dblog.overview')));
 | 
					        $message = \Drupal::translation()->formatPlural(count($results['failed_files']), 'One translation file could not be imported. <a href="@url">See the log</a> for details.', '@count translation files could not be imported. <a href="@url">See the log</a> for details.', array('@url' => \Drupal::url('dblog.overview')));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      else {
 | 
					      else {
 | 
				
			||||||
        $message = format_plural(count($results['failed_files']), 'One translation file could not be imported. See the log for details.', '@count translation files could not be imported. See the log for details.');
 | 
					        $message = \Drupal::translation()->formatPlural(count($results['failed_files']), 'One translation file could not be imported. See the log for details.', '@count translation files could not be imported. See the log for details.');
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      drupal_set_message($message, 'error');
 | 
					      drupal_set_message($message, 'error');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -381,7 +381,7 @@ function locale_translate_batch_finished($success, array $results) {
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      drupal_set_message(format_plural(count($results['files']),
 | 
					      drupal_set_message(\Drupal::translation()->formatPlural(count($results['files']),
 | 
				
			||||||
        'One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.',
 | 
					        'One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.',
 | 
				
			||||||
        '@count translation files imported. %number translations were added, %update translations were updated and %delete translations were removed.',
 | 
					        '@count translation files imported. %number translations were added, %update translations were updated and %delete translations were removed.',
 | 
				
			||||||
        array('%number' => $additions, '%update' => $updates, '%delete' => $deletes)
 | 
					        array('%number' => $additions, '%update' => $updates, '%delete' => $deletes)
 | 
				
			||||||
| 
						 | 
					@ -390,10 +390,10 @@ function locale_translate_batch_finished($success, array $results) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if ($skips) {
 | 
					      if ($skips) {
 | 
				
			||||||
        if (\Drupal::moduleHandler()->moduleExists('dblog') && \Drupal::currentUser()->hasPermission('access site reports')) {
 | 
					        if (\Drupal::moduleHandler()->moduleExists('dblog') && \Drupal::currentUser()->hasPermission('access site reports')) {
 | 
				
			||||||
          $message = format_plural($skips, 'One translation string was skipped because of disallowed or malformed HTML. <a href="@url">See the log</a> for details.', '@count translation strings were skipped because of disallowed or malformed HTML. <a href="@url">See the log</a> for details.', array('@url' => \Drupal::url('dblog.overview')));
 | 
					          $message = \Drupal::translation()->formatPlural($skips, 'One translation string was skipped because of disallowed or malformed HTML. <a href="@url">See the log</a> for details.', '@count translation strings were skipped because of disallowed or malformed HTML. <a href="@url">See the log</a> for details.', array('@url' => \Drupal::url('dblog.overview')));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
          $message = format_plural($skips, 'One translation string was skipped because of disallowed or malformed HTML. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.');
 | 
					          $message = \Drupal::translation()->formatPlural($skips, 'One translation string was skipped because of disallowed or malformed HTML. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        drupal_set_message($message, 'warning');
 | 
					        drupal_set_message($message, 'warning');
 | 
				
			||||||
        $logger->warning('@count disallowed HTML string(s) in files: @files.', array('@count' => $skips, '@files' => implode(',', $skipped_files)));
 | 
					        $logger->warning('@count disallowed HTML string(s) in files: @files.', array('@count' => $skips, '@files' => implode(',', $skipped_files)));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,7 +73,7 @@ function template_preprocess_locale_translation_update_info(array &$variables) {
 | 
				
			||||||
  // Build output for updates not found.
 | 
					  // Build output for updates not found.
 | 
				
			||||||
  if (isset($variables['not_found'])) {
 | 
					  if (isset($variables['not_found'])) {
 | 
				
			||||||
    $releases = array();
 | 
					    $releases = array();
 | 
				
			||||||
    $variables['missing_updates_status'] = format_plural(count($variables['not_found']), 'Missing translations for one project', 'Missing translations for @count projects');
 | 
					    $variables['missing_updates_status'] = \Drupal::translation()->formatPlural(count($variables['not_found']), 'Missing translations for one project', 'Missing translations for @count projects');
 | 
				
			||||||
    if ($variables['not_found']) {
 | 
					    if ($variables['not_found']) {
 | 
				
			||||||
      foreach ($variables['not_found'] as $update) {
 | 
					      foreach ($variables['not_found'] as $update) {
 | 
				
			||||||
        $version = $update['version'] ? $update['version'] : t('no version');
 | 
					        $version = $update['version'] ? $update['version'] : t('no version');
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -125,7 +125,7 @@ class TranslateEditForm extends TranslateFormBase {
 | 
				
			||||||
            for ($i = 0; $i < $plural_formulas[$langcode]['plurals']; $i++) {
 | 
					            for ($i = 0; $i < $plural_formulas[$langcode]['plurals']; $i++) {
 | 
				
			||||||
              $form['strings'][$string->lid]['translations'][$i] = array(
 | 
					              $form['strings'][$string->lid]['translations'][$i] = array(
 | 
				
			||||||
                '#type' => 'textarea',
 | 
					                '#type' => 'textarea',
 | 
				
			||||||
                '#title' => ($i == 0 ? $this->t('Singular form') : format_plural($i, 'First plural form', '@count. plural form')),
 | 
					                '#title' => ($i == 0 ? $this->t('Singular form') : $this->formatPlural($i, 'First plural form', '@count. plural form')),
 | 
				
			||||||
                '#rows' => $rows,
 | 
					                '#rows' => $rows,
 | 
				
			||||||
                '#default_value' => isset($translation_array[$i]) ? $translation_array[$i] : '',
 | 
					                '#default_value' => isset($translation_array[$i]) ? $translation_array[$i] : '',
 | 
				
			||||||
                '#attributes' => array('lang' => $langcode),
 | 
					                '#attributes' => array('lang' => $langcode),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,8 @@ class LocalePluralFormatTest extends WebTestBase {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
   * Tests locale_get_plural() and format_plural() functionality.
 | 
					   * Tests locale_get_plural() and \Drupal::translation()->formatPlural()
 | 
				
			||||||
 | 
					   * functionality.
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  public function testGetPluralFormat() {
 | 
					  public function testGetPluralFormat() {
 | 
				
			||||||
    // Import some .po files with formulas to set up the environment.
 | 
					    // Import some .po files with formulas to set up the environment.
 | 
				
			||||||
| 
						 | 
					@ -129,7 +130,7 @@ class LocalePluralFormatTest extends WebTestBase {
 | 
				
			||||||
        // expected index as per the logic for translation lookups.
 | 
					        // expected index as per the logic for translation lookups.
 | 
				
			||||||
        $expected_plural_index = ($count == 1) ? 0 : $expected_plural_index;
 | 
					        $expected_plural_index = ($count == 1) ? 0 : $expected_plural_index;
 | 
				
			||||||
        $expected_plural_string = str_replace('@count', $count, $plural_strings[$langcode][$expected_plural_index]);
 | 
					        $expected_plural_string = str_replace('@count', $count, $plural_strings[$langcode][$expected_plural_index]);
 | 
				
			||||||
        $this->assertIdentical(format_plural($count, '1 hour', '@count hours', array(), array('langcode' => $langcode)), $expected_plural_string, 'Plural translation of 1 hours / @count hours for count ' . $count . ' in ' . $langcode . ' is ' . $expected_plural_string);
 | 
					        $this->assertIdentical(\Drupal::translation()->formatPlural($count, '1 hour', '@count hours', array(), array('langcode' => $langcode)), $expected_plural_string, 'Plural translation of 1 hours / @count hours for count ' . $count . ' in ' . $langcode . ' is ' . $expected_plural_string);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -217,7 +218,7 @@ class LocalePluralFormatTest extends WebTestBase {
 | 
				
			||||||
    // langcode here because the language will be English by default and will
 | 
					    // langcode here because the language will be English by default and will
 | 
				
			||||||
    // not save our source string for performance optimization if we do not ask
 | 
					    // not save our source string for performance optimization if we do not ask
 | 
				
			||||||
    // specifically for a language.
 | 
					    // specifically for a language.
 | 
				
			||||||
    format_plural(1, '1 day', '@count days', array(), array('langcode' => 'fr'));
 | 
					    \Drupal::translation()->formatPlural(1, '1 day', '@count days', array(), array('langcode' => 'fr'));
 | 
				
			||||||
    $lid = db_query("SELECT lid FROM {locales_source} WHERE source = :source AND context = ''", array(':source' => "1 day" . LOCALE_PLURAL_DELIMITER . "@count days"))->fetchField();
 | 
					    $lid = db_query("SELECT lid FROM {locales_source} WHERE source = :source AND context = ''", array(':source' => "1 day" . LOCALE_PLURAL_DELIMITER . "@count days"))->fetchField();
 | 
				
			||||||
    // Look up editing page for this plural string and check fields.
 | 
					    // Look up editing page for this plural string and check fields.
 | 
				
			||||||
    $search = array(
 | 
					    $search = array(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,7 +76,7 @@ class MenuDeleteForm extends EntityConfirmFormBase {
 | 
				
			||||||
    $caption = '';
 | 
					    $caption = '';
 | 
				
			||||||
    $num_links = $this->menuLinkManager->countMenuLinks($this->entity->id());
 | 
					    $num_links = $this->menuLinkManager->countMenuLinks($this->entity->id());
 | 
				
			||||||
    if ($num_links) {
 | 
					    if ($num_links) {
 | 
				
			||||||
      $caption .= '<p>' . format_plural($num_links, '<strong>Warning:</strong> There is currently 1 menu link in %title. It will be deleted (system-defined items will be reset).', '<strong>Warning:</strong> There are currently @count menu links in %title. They will be deleted (system-defined links will be reset).', array('%title' => $this->entity->label())) . '</p>';
 | 
					      $caption .= '<p>' . $this->formatPlural($num_links, '<strong>Warning:</strong> There is currently 1 menu link in %title. It will be deleted (system-defined items will be reset).', '<strong>Warning:</strong> There are currently @count menu links in %title. They will be deleted (system-defined links will be reset).', array('%title' => $this->entity->label())) . '</p>';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    $caption .= '<p>' . t('This action cannot be undone.') . '</p>';
 | 
					    $caption .= '<p>' . t('This action cannot be undone.') . '</p>';
 | 
				
			||||||
    return $caption;
 | 
					    return $caption;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -159,7 +159,7 @@ function _node_mass_update_batch_finished($success, $results, $operations) {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
    drupal_set_message(t('An error occurred and processing did not complete.'), 'error');
 | 
					    drupal_set_message(t('An error occurred and processing did not complete.'), 'error');
 | 
				
			||||||
    $message = format_plural(count($results), '1 item successfully processed:', '@count items successfully processed:');
 | 
					    $message = \Drupal::translation()->formatPlural(count($results), '1 item successfully processed:', '@count items successfully processed:');
 | 
				
			||||||
    $item_list = array(
 | 
					    $item_list = array(
 | 
				
			||||||
      '#theme' => 'item_list',
 | 
					      '#theme' => 'item_list',
 | 
				
			||||||
      '#items' => $results,
 | 
					      '#items' => $results,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -380,7 +380,7 @@ function hook_node_access(\Drupal\node\NodeInterface $node, $op, \Drupal\Core\Se
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
function hook_node_search_result(\Drupal\node\NodeInterface $node, $langcode) {
 | 
					function hook_node_search_result(\Drupal\node\NodeInterface $node, $langcode) {
 | 
				
			||||||
  $rating = db_query('SELECT SUM(points) FROM {my_rating} WHERE nid = :nid', array('nid' => $node->id()))->fetchField();
 | 
					  $rating = db_query('SELECT SUM(points) FROM {my_rating} WHERE nid = :nid', array('nid' => $node->id()))->fetchField();
 | 
				
			||||||
  return array('rating' => format_plural($rating, '1 point', '@count points'));
 | 
					  return array('rating' => \Drupal::translation()->formatPlural($rating, '1 point', '@count points'));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ function node_requirements($phase) {
 | 
				
			||||||
    // implement hook_node_grants().
 | 
					    // implement hook_node_grants().
 | 
				
			||||||
    $grant_count = \Drupal::entityManager()->getAccessControlHandler('node')->countGrants();
 | 
					    $grant_count = \Drupal::entityManager()->getAccessControlHandler('node')->countGrants();
 | 
				
			||||||
    if ($grant_count != 1 || count(\Drupal::moduleHandler()->getImplementations('node_grants')) > 0) {
 | 
					    if ($grant_count != 1 || count(\Drupal::moduleHandler()->getImplementations('node_grants')) > 0) {
 | 
				
			||||||
      $value = format_plural($grant_count, 'One permission in use', '@count permissions in use', array('@count' => $grant_count));
 | 
					      $value = \Drupal::translation()->formatPlural($grant_count, 'One permission in use', '@count permissions in use', array('@count' => $grant_count));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
      $value = t('Disabled');
 | 
					      $value = t('Disabled');
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -190,7 +190,7 @@ function node_title_list(StatementInterface $result, $title = NULL) {
 | 
				
			||||||
  foreach ($result as $row) {
 | 
					  foreach ($result as $row) {
 | 
				
			||||||
    // Do not use $node->label() or $node->urlInfo() here, because we only have
 | 
					    // Do not use $node->label() or $node->urlInfo() here, because we only have
 | 
				
			||||||
    // database rows, not actual nodes.
 | 
					    // database rows, not actual nodes.
 | 
				
			||||||
    $options = !empty($row->comment_count) ? array('attributes' => array('title' => format_plural($row->comment_count, '1 comment', '@count comments'))) : array();
 | 
					    $options = !empty($row->comment_count) ? array('attributes' => array('title' => \Drupal::translation()->formatPlural($row->comment_count, '1 comment', '@count comments'))) : array();
 | 
				
			||||||
    $items[] = \Drupal::l($row->title, new Url('entity.node.canonical', ['node' => $row->nid], $options));
 | 
					    $items[] = \Drupal::l($row->title, new Url('entity.node.canonical', ['node' => $row->nid], $options));
 | 
				
			||||||
    $num_rows = TRUE;
 | 
					    $num_rows = TRUE;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -162,7 +162,7 @@ class NodeType extends ConfigEntityBundleBase implements NodeTypeInterface {
 | 
				
			||||||
    if ($update && $this->getOriginalId() != $this->id()) {
 | 
					    if ($update && $this->getOriginalId() != $this->id()) {
 | 
				
			||||||
      $update_count = node_type_update_nodes($this->getOriginalId(), $this->id());
 | 
					      $update_count = node_type_update_nodes($this->getOriginalId(), $this->id());
 | 
				
			||||||
      if ($update_count) {
 | 
					      if ($update_count) {
 | 
				
			||||||
        drupal_set_message(format_plural($update_count,
 | 
					        drupal_set_message(\Drupal::translation()->formatPlural($update_count,
 | 
				
			||||||
          'Changed the content type of 1 post from %old-type to %type.',
 | 
					          'Changed the content type of 1 post from %old-type to %type.',
 | 
				
			||||||
          'Changed the content type of @count posts from %old-type to %type.',
 | 
					          'Changed the content type of @count posts from %old-type to %type.',
 | 
				
			||||||
          array(
 | 
					          array(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,7 +76,7 @@ class DeleteMultiple extends ConfirmFormBase {
 | 
				
			||||||
   * {@inheritdoc}
 | 
					   * {@inheritdoc}
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  public function getQuestion() {
 | 
					  public function getQuestion() {
 | 
				
			||||||
    return format_plural(count($this->nodes), 'Are you sure you want to delete this item?', 'Are you sure you want to delete these items?');
 | 
					    return $this->formatPlural(count($this->nodes), 'Are you sure you want to delete this item?', 'Are you sure you want to delete these items?');
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
| 
						 | 
					@ -122,7 +122,7 @@ class DeleteMultiple extends ConfirmFormBase {
 | 
				
			||||||
      $this->tempStoreFactory->get('node_multiple_delete_confirm')->delete(\Drupal::currentUser()->id());
 | 
					      $this->tempStoreFactory->get('node_multiple_delete_confirm')->delete(\Drupal::currentUser()->id());
 | 
				
			||||||
      $count = count($this->nodes);
 | 
					      $count = count($this->nodes);
 | 
				
			||||||
      $this->logger('content')->notice('Deleted @count posts.', array('@count' => $count));
 | 
					      $this->logger('content')->notice('Deleted @count posts.', array('@count' => $count));
 | 
				
			||||||
      drupal_set_message(format_plural($count, 'Deleted 1 post.', 'Deleted @count posts.'));
 | 
					      drupal_set_message($this->formatPlural($count, 'Deleted 1 post.', 'Deleted @count posts.'));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    $form_state->setRedirect('system.admin_content');
 | 
					    $form_state->setRedirect('system.admin_content');
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,7 +74,7 @@ class NodeTypeDeleteConfirm extends EntityConfirmFormBase {
 | 
				
			||||||
      ->count()
 | 
					      ->count()
 | 
				
			||||||
      ->execute();
 | 
					      ->execute();
 | 
				
			||||||
    if ($num_nodes) {
 | 
					    if ($num_nodes) {
 | 
				
			||||||
      $caption = '<p>' . format_plural($num_nodes, '%type is used by 1 piece of content on your site. You can not remove this content type until you have removed all of the %type content.', '%type is used by @count pieces of content on your site. You may not remove %type until you have removed all of the %type content.', array('%type' => $this->entity->label())) . '</p>';
 | 
					      $caption = '<p>' . $this->formatPlural($num_nodes, '%type is used by 1 piece of content on your site. You can not remove this content type until you have removed all of the %type content.', '%type is used by @count pieces of content on your site. You may not remove %type until you have removed all of the %type content.', array('%type' => $this->entity->label())) . '</p>';
 | 
				
			||||||
      $form['#title'] = $this->getQuestion();
 | 
					      $form['#title'] = $this->getQuestion();
 | 
				
			||||||
      $form['description'] = array('#markup' => $caption);
 | 
					      $form['description'] = array('#markup' => $caption);
 | 
				
			||||||
      return $form;
 | 
					      return $form;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -265,7 +265,7 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ($status & SearchQuery::NO_POSITIVE_KEYWORDS) {
 | 
					    if ($status & SearchQuery::NO_POSITIVE_KEYWORDS) {
 | 
				
			||||||
      drupal_set_message(\Drupal::translation()->formatPlural($this->searchSettings->get('index.minimum_word_size'), 'You must include at least one positive keyword with 1 character or more.', 'You must include at least one positive keyword with @count characters or more.'), 'warning');
 | 
					      drupal_set_message($this->formatPlural($this->searchSettings->get('index.minimum_word_size'), 'You must include at least one positive keyword with 1 character or more.', 'You must include at least one positive keyword with @count characters or more.'), 'warning');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return $find;
 | 
					    return $find;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -108,7 +108,7 @@ class Search extends FilterPluginBase {
 | 
				
			||||||
    if (!$form_state->isValueEmpty($key)) {
 | 
					    if (!$form_state->isValueEmpty($key)) {
 | 
				
			||||||
      $this->queryParseSearchExpression($form_state->getValue($key));
 | 
					      $this->queryParseSearchExpression($form_state->getValue($key));
 | 
				
			||||||
      if (count($this->searchQuery->words()) == 0) {
 | 
					      if (count($this->searchQuery->words()) == 0) {
 | 
				
			||||||
        $form_state->setErrorByName($key, format_plural(\Drupal::config('search.settings')->get('index.minimum_word_size'), 'You must include at least one positive keyword with 1 character or more.', 'You must include at least one positive keyword with @count characters or more.'));
 | 
					        $form_state->setErrorByName($key, $this->formatPlural(\Drupal::config('search.settings')->get('index.minimum_word_size'), 'You must include at least one positive keyword with 1 character or more.', 'You must include at least one positive keyword with @count characters or more.'));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -170,7 +170,7 @@ class SearchPageListBuilder extends DraggableListBuilder implements FormInterfac
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $this->moduleHandler->loadAllIncludes('admin.inc');
 | 
					    $this->moduleHandler->loadAllIncludes('admin.inc');
 | 
				
			||||||
    $count = format_plural($remaining, 'There is 1 item left to index.', 'There are @count items left to index.');
 | 
					    $count = $this->formatPlural($remaining, 'There is 1 item left to index.', 'There are @count items left to index.');
 | 
				
			||||||
    $done = $total - $remaining;
 | 
					    $done = $total - $remaining;
 | 
				
			||||||
    // Use floor() to calculate the percentage, so if it is not quite 100%, it
 | 
					    // Use floor() to calculate the percentage, so if it is not quite 100%, it
 | 
				
			||||||
    // will show as 99%, to indicate "almost done".
 | 
					    // will show as 99%, to indicate "almost done".
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -278,7 +278,9 @@ class SearchMultilingualEntityTest extends SearchTestBase {
 | 
				
			||||||
    $this->assertEqual($status['total'], $total, 'Total items ' . $message . ' is ' . $total);
 | 
					    $this->assertEqual($status['total'], $total, 'Total items ' . $message . ' is ' . $total);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Check text in progress section of Search settings page. Note that this
 | 
					    // Check text in progress section of Search settings page. Note that this
 | 
				
			||||||
    // test avoids using format_plural(), so it tests for fragments of text.
 | 
					    // test avoids using
 | 
				
			||||||
 | 
					    // \Drupal\Core\StringTranslation\TranslationInterface::formatPlural(), so
 | 
				
			||||||
 | 
					    // it tests for fragments of text.
 | 
				
			||||||
    $indexed = $total - $remaining;
 | 
					    $indexed = $total - $remaining;
 | 
				
			||||||
    $percent = ($total > 0) ? floor(100 * $indexed / $total) : 100;
 | 
					    $percent = ($total > 0) ? floor(100 * $indexed / $total) : 100;
 | 
				
			||||||
    $this->drupalGet('admin/config/search/pages');
 | 
					    $this->drupalGet('admin/config/search/pages');
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,7 +80,7 @@ class ShortcutSetDeleteForm extends EntityConfirmFormBase {
 | 
				
			||||||
    $number = $this->storage->countAssignedUsers($this->entity);
 | 
					    $number = $this->storage->countAssignedUsers($this->entity);
 | 
				
			||||||
    $info = '';
 | 
					    $info = '';
 | 
				
			||||||
    if ($number) {
 | 
					    if ($number) {
 | 
				
			||||||
      $info .= '<p>' . format_plural($number,
 | 
					      $info .= '<p>' . $this->formatPlural($number,
 | 
				
			||||||
        '1 user has chosen or been assigned to this shortcut set.',
 | 
					        '1 user has chosen or been assigned to this shortcut set.',
 | 
				
			||||||
        '@count users have chosen or been assigned to this shortcut set.') . '</p>';
 | 
					        '@count users have chosen or been assigned to this shortcut set.') . '</p>';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -528,7 +528,7 @@ function simpletest_clean_environment() {
 | 
				
			||||||
  simpletest_clean_temporary_directories();
 | 
					  simpletest_clean_temporary_directories();
 | 
				
			||||||
  if (\Drupal::config('simpletest.settings')->get('clear_results')) {
 | 
					  if (\Drupal::config('simpletest.settings')->get('clear_results')) {
 | 
				
			||||||
    $count = simpletest_clean_results_table();
 | 
					    $count = simpletest_clean_results_table();
 | 
				
			||||||
    drupal_set_message(format_plural($count, 'Removed 1 test result.', 'Removed @count test results.'));
 | 
					    drupal_set_message(\Drupal::translation()->formatPlural($count, 'Removed 1 test result.', 'Removed @count test results.'));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
    drupal_set_message(t('Clear results is disabled and the test results table will not be cleared.'), 'warning');
 | 
					    drupal_set_message(t('Clear results is disabled and the test results table will not be cleared.'), 'warning');
 | 
				
			||||||
| 
						 | 
					@ -556,7 +556,7 @@ function simpletest_clean_database() {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if ($count > 0) {
 | 
					  if ($count > 0) {
 | 
				
			||||||
    drupal_set_message(format_plural($count, 'Removed 1 leftover table.', 'Removed @count leftover tables.'));
 | 
					    drupal_set_message(\Drupal::translation()->formatPlural($count, 'Removed 1 leftover table.', 'Removed @count leftover tables.'));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
    drupal_set_message(t('No leftover tables to remove.'));
 | 
					    drupal_set_message(t('No leftover tables to remove.'));
 | 
				
			||||||
| 
						 | 
					@ -580,7 +580,7 @@ function simpletest_clean_temporary_directories() {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if ($count > 0) {
 | 
					  if ($count > 0) {
 | 
				
			||||||
    drupal_set_message(format_plural($count, 'Removed 1 temporary directory.', 'Removed @count temporary directories.'));
 | 
					    drupal_set_message(\Drupal::translation()->formatPlural($count, 'Removed 1 temporary directory.', 'Removed @count temporary directories.'));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
    drupal_set_message(t('No temporary directories to remove.'));
 | 
					    drupal_set_message(t('No temporary directories to remove.'));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,7 +52,7 @@ function statistics_node_links_alter(array &$node_links, NodeInterface $entity,
 | 
				
			||||||
    if (\Drupal::currentUser()->hasPermission('view post access counter')) {
 | 
					    if (\Drupal::currentUser()->hasPermission('view post access counter')) {
 | 
				
			||||||
      $statistics = statistics_get($entity->id());
 | 
					      $statistics = statistics_get($entity->id());
 | 
				
			||||||
      if ($statistics) {
 | 
					      if ($statistics) {
 | 
				
			||||||
        $links['statistics_counter']['title'] = format_plural($statistics['totalcount'], '1 view', '@count views');
 | 
					        $links['statistics_counter']['title'] = \Drupal::translation()->formatPlural($statistics['totalcount'], '1 view', '@count views');
 | 
				
			||||||
        $node_links['statistics'] = array(
 | 
					        $node_links['statistics'] = array(
 | 
				
			||||||
          '#theme' => 'links__node__statistics',
 | 
					          '#theme' => 'links__node__statistics',
 | 
				
			||||||
          '#links' => $links,
 | 
					          '#links' => $links,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -126,7 +126,7 @@ class ModulesListConfirmForm extends ConfirmFormBase {
 | 
				
			||||||
    // Display a list of required modules that have to be installed as well but
 | 
					    // Display a list of required modules that have to be installed as well but
 | 
				
			||||||
    // were not manually selected.
 | 
					    // were not manually selected.
 | 
				
			||||||
    foreach ($this->modules['dependencies'] as $module => $dependencies) {
 | 
					    foreach ($this->modules['dependencies'] as $module => $dependencies) {
 | 
				
			||||||
      $items[] = format_plural(count($dependencies), 'You must enable the @required module to install @module.', 'You must enable the @required modules to install @module.', array(
 | 
					      $items[] = $this->formatPlural(count($dependencies), 'You must enable the @required module to install @module.', 'You must enable the @required modules to install @module.', array(
 | 
				
			||||||
        '@module' => $this->modules['install'][$module],
 | 
					        '@module' => $this->modules['install'][$module],
 | 
				
			||||||
        '@required' => implode(', ', $dependencies),
 | 
					        '@required' => implode(', ', $dependencies),
 | 
				
			||||||
      ));
 | 
					      ));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,7 +74,7 @@ class InfoParserUnitTest extends KernelTestBase {
 | 
				
			||||||
      $this->fail('Expected InfoParserException not thrown when reading missing_key.info.txt');
 | 
					      $this->fail('Expected InfoParserException not thrown when reading missing_key.info.txt');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    catch (InfoParserException $e) {
 | 
					    catch (InfoParserException $e) {
 | 
				
			||||||
      $expected_message = "Missing required key (type) in $filename.";
 | 
					      $expected_message = "Missing required keys (type) in $filename.";
 | 
				
			||||||
      $this->assertEqual($e->getMessage(), $expected_message);
 | 
					      $this->assertEqual($e->getMessage(), $expected_message);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -606,7 +606,7 @@ function system_requirements($phase) {
 | 
				
			||||||
      $requirements['disabled_modules'] = array(
 | 
					      $requirements['disabled_modules'] = array(
 | 
				
			||||||
        'severity' => REQUIREMENT_ERROR,
 | 
					        'severity' => REQUIREMENT_ERROR,
 | 
				
			||||||
        'title' => t('Disabled modules'),
 | 
					        'title' => t('Disabled modules'),
 | 
				
			||||||
        'value' => format_plural(count($modules), 'The %modules module is disabled.', 'The following modules are disabled: %modules', array('%modules' => implode(', ', $modules))),
 | 
					        'value' => \Drupal::translation()->formatPlural(count($modules), 'The %modules module is disabled.', 'The following modules are disabled: %modules', array('%modules' => implode(', ', $modules))),
 | 
				
			||||||
        'description' => t('Drupal 8 no longer supports disabled modules. Please either enable or uninstall them before upgrading.'),
 | 
					        'description' => t('Drupal 8 no longer supports disabled modules. Please either enable or uninstall them before upgrading.'),
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -373,7 +373,7 @@ class TaxonomyIndexTid extends ManyToOne {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ($missing && !empty($this->options['error_message'])) {
 | 
					    if ($missing && !empty($this->options['error_message'])) {
 | 
				
			||||||
      $form_state->setError($form, format_plural(count($missing), 'Unable to find term: @terms', 'Unable to find terms: @terms', array('@terms' => implode(', ', array_keys($missing)))));
 | 
					      $form_state->setError($form, $this->formatPlural(count($missing), 'Unable to find term: @terms', 'Unable to find terms: @terms', array('@terms' => implode(', ', array_keys($missing)))));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    elseif ($missing && empty($this->options['error_message'])) {
 | 
					    elseif ($missing && empty($this->options['error_message'])) {
 | 
				
			||||||
      $tids = array(0);
 | 
					      $tids = array(0);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -112,7 +112,7 @@ function _update_manager_check_backends(&$form, $operation) {
 | 
				
			||||||
    $backend_names[] = $backend['title'];
 | 
					    $backend_names[] = $backend['title'];
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if ($operation == 'update') {
 | 
					  if ($operation == 'update') {
 | 
				
			||||||
    $form['available_backends']['#markup'] = format_plural(
 | 
					    $form['available_backends']['#markup'] = \Drupal::translation()->formatPlural(
 | 
				
			||||||
      count($available_backends),
 | 
					      count($available_backends),
 | 
				
			||||||
      'Updating modules and themes requires <strong>@backends access</strong> to your server. See the <a href="@handbook_url">handbook</a> for other update methods.',
 | 
					      'Updating modules and themes requires <strong>@backends access</strong> to your server. See the <a href="@handbook_url">handbook</a> for other update methods.',
 | 
				
			||||||
      'Updating modules and themes requires access to your server via one of the following methods: <strong>@backends</strong>. See the <a href="@handbook_url">handbook</a> for other update methods.',
 | 
					      'Updating modules and themes requires access to your server via one of the following methods: <strong>@backends</strong>. See the <a href="@handbook_url">handbook</a> for other update methods.',
 | 
				
			||||||
| 
						 | 
					@ -122,7 +122,7 @@ function _update_manager_check_backends(&$form, $operation) {
 | 
				
			||||||
      ));
 | 
					      ));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
    $form['available_backends']['#markup'] = format_plural(
 | 
					    $form['available_backends']['#markup'] = \Drupal::translation()->formatPlural(
 | 
				
			||||||
      count($available_backends),
 | 
					      count($available_backends),
 | 
				
			||||||
      'Installing modules and themes requires <strong>@backends access</strong> to your server. See the <a href="@handbook_url">handbook</a> for other installation methods.',
 | 
					      'Installing modules and themes requires <strong>@backends access</strong> to your server. See the <a href="@handbook_url">handbook</a> for other installation methods.',
 | 
				
			||||||
      'Installing modules and themes requires access to your server via one of the following methods: <strong>@backends</strong>. See the <a href="@handbook_url">handbook</a> for other installation methods.',
 | 
					      'Installing modules and themes requires access to your server via one of the following methods: <strong>@backends</strong>. See the <a href="@handbook_url">handbook</a> for other installation methods.',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -420,10 +420,10 @@ function update_fetch_data_finished($success, $results) {
 | 
				
			||||||
  if ($success) {
 | 
					  if ($success) {
 | 
				
			||||||
    if (!empty($results)) {
 | 
					    if (!empty($results)) {
 | 
				
			||||||
      if (!empty($results['updated'])) {
 | 
					      if (!empty($results['updated'])) {
 | 
				
			||||||
        drupal_set_message(format_plural($results['updated'], 'Checked available update data for one project.', 'Checked available update data for @count projects.'));
 | 
					        drupal_set_message(\Drupal::translation()->formatPlural($results['updated'], 'Checked available update data for one project.', 'Checked available update data for @count projects.'));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      if (!empty($results['failures'])) {
 | 
					      if (!empty($results['failures'])) {
 | 
				
			||||||
        drupal_set_message(format_plural($results['failures'], 'Failed to get available update data for one project.', 'Failed to get available update data for @count projects.'), 'error');
 | 
					        drupal_set_message(\Drupal::translation()->formatPlural($results['failures'], 'Failed to get available update data for one project.', 'Failed to get available update data for @count projects.'), 'error');
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -652,7 +652,7 @@ function update_verify_update_archive($project, $archive_file, $directory) {
 | 
				
			||||||
    $errors[] = t('%archive_file does not contain any .info.yml files.', array('%archive_file' => drupal_basename($archive_file)));
 | 
					    $errors[] = t('%archive_file does not contain any .info.yml files.', array('%archive_file' => drupal_basename($archive_file)));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  elseif (!$compatible_project) {
 | 
					  elseif (!$compatible_project) {
 | 
				
			||||||
    $errors[] = format_plural(
 | 
					    $errors[] = \Drupal::translation()->formatPlural(
 | 
				
			||||||
      count($incompatible),
 | 
					      count($incompatible),
 | 
				
			||||||
      '%archive_file contains a version of %names that is not compatible with Drupal !version.',
 | 
					      '%archive_file contains a version of %names that is not compatible with Drupal !version.',
 | 
				
			||||||
      '%archive_file contains versions of modules or themes that are not compatible with Drupal !version: %names',
 | 
					      '%archive_file contains versions of modules or themes that are not compatible with Drupal !version: %names',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -207,7 +207,7 @@ class UserLoginForm extends FormBase {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if ($flood_control_triggered = $form_state->get('flood_control_triggered')) {
 | 
					      if ($flood_control_triggered = $form_state->get('flood_control_triggered')) {
 | 
				
			||||||
        if ($flood_control_triggered == 'user') {
 | 
					        if ($flood_control_triggered == 'user') {
 | 
				
			||||||
          $form_state->setErrorByName('name', format_plural($flood_config->get('user_limit'), 'Sorry, there has been more than one failed login attempt for this account. It is temporarily blocked. Try again later or <a href="@url">request a new password</a>.', 'Sorry, there have been more than @count failed login attempts for this account. It is temporarily blocked. Try again later or <a href="@url">request a new password</a>.', array('@url' => $this->url('user.pass'))));
 | 
					          $form_state->setErrorByName('name', $this->formatPlural($flood_config->get('user_limit'), 'Sorry, there has been more than one failed login attempt for this account. It is temporarily blocked. Try again later or <a href="@url">request a new password</a>.', 'Sorry, there have been more than @count failed login attempts for this account. It is temporarily blocked. Try again later or <a href="@url">request a new password</a>.', array('@url' => $this->url('user.pass'))));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
          // We did not find a uid, so the limit is IP-based.
 | 
					          // We did not find a uid, so the limit is IP-based.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -135,7 +135,7 @@ class Name extends InOperator {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ($missing) {
 | 
					    if ($missing) {
 | 
				
			||||||
      $form_state->setError($form, format_plural(count($missing), 'Unable to find user: @users', 'Unable to find users: @users', array('@users' => implode(', ', array_keys($missing)))));
 | 
					      $form_state->setError($form, $this->formatPlural(count($missing), 'Unable to find user: @users', 'Unable to find users: @users', array('@users' => implode(', ', array_keys($missing)))));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return $uids;
 | 
					    return $uids;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -155,7 +155,7 @@ class UserLoginTest extends WebTestBase {
 | 
				
			||||||
    $this->assertNoFieldByXPath("//input[@name='pass' and @value!='']", NULL, 'Password value attribute is blank.');
 | 
					    $this->assertNoFieldByXPath("//input[@name='pass' and @value!='']", NULL, 'Password value attribute is blank.');
 | 
				
			||||||
    if (isset($flood_trigger)) {
 | 
					    if (isset($flood_trigger)) {
 | 
				
			||||||
      if ($flood_trigger == 'user') {
 | 
					      if ($flood_trigger == 'user') {
 | 
				
			||||||
        $this->assertRaw(format_plural($this->config('user.flood')->get('user_limit'), 'Sorry, there has been more than one failed login attempt for this account. It is temporarily blocked. Try again later or <a href="@url">request a new password</a>.', 'Sorry, there have been more than @count failed login attempts for this account. It is temporarily blocked. Try again later or <a href="@url">request a new password</a>.', array('@url' => \Drupal::url('user.pass'))));
 | 
					        $this->assertRaw(\Drupal::translation()->formatPlural($this->config('user.flood')->get('user_limit'), 'Sorry, there has been more than one failed login attempt for this account. It is temporarily blocked. Try again later or <a href="@url">request a new password</a>.', 'Sorry, there have been more than @count failed login attempts for this account. It is temporarily blocked. Try again later or <a href="@url">request a new password</a>.', array('@url' => \Drupal::url('user.pass'))));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      else {
 | 
					      else {
 | 
				
			||||||
        // No uid, so the limit is IP-based.
 | 
					        // No uid, so the limit is IP-based.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -102,7 +102,7 @@ class HandlerFilterUserNameTest extends ViewTestBase {
 | 
				
			||||||
      'options[value]' => implode(', ', $users)
 | 
					      'options[value]' => implode(', ', $users)
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
    $this->drupalPostForm($path, $edit, t('Apply'));
 | 
					    $this->drupalPostForm($path, $edit, t('Apply'));
 | 
				
			||||||
    $message = format_plural(count($users), 'Unable to find user: @users', 'Unable to find users: @users', array('@users' => implode(', ', $users)));
 | 
					    $message = \Drupal::translation()->formatPlural(count($users), 'Unable to find user: @users', 'Unable to find users: @users', array('@users' => implode(', ', $users)));
 | 
				
			||||||
    $this->assertText($message);
 | 
					    $this->assertText($message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Pass in an invalid username and a valid username.
 | 
					    // Pass in an invalid username and a valid username.
 | 
				
			||||||
| 
						 | 
					@ -114,7 +114,7 @@ class HandlerFilterUserNameTest extends ViewTestBase {
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
    $users = array($users[0]);
 | 
					    $users = array($users[0]);
 | 
				
			||||||
    $this->drupalPostForm($path, $edit, t('Apply'));
 | 
					    $this->drupalPostForm($path, $edit, t('Apply'));
 | 
				
			||||||
    $message = format_plural(count($users), 'Unable to find user: @users', 'Unable to find users: @users', array('@users' => implode(', ', $users)));
 | 
					    $message = \Drupal::translation()->formatPlural(count($users), 'Unable to find user: @users', 'Unable to find users: @users', array('@users' => implode(', ', $users)));
 | 
				
			||||||
    $this->assertRaw($message);
 | 
					    $this->assertRaw($message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Pass in just valid usernames.
 | 
					    // Pass in just valid usernames.
 | 
				
			||||||
| 
						 | 
					@ -124,7 +124,7 @@ class HandlerFilterUserNameTest extends ViewTestBase {
 | 
				
			||||||
      'options[value]' => implode(', ', $users)
 | 
					      'options[value]' => implode(', ', $users)
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
    $this->drupalPostForm($path, $edit, t('Apply'));
 | 
					    $this->drupalPostForm($path, $edit, t('Apply'));
 | 
				
			||||||
    $message = format_plural(count($users), 'Unable to find user: @users', 'Unable to find users: @users', array('@users' => implode(', ', $users)));
 | 
					    $message = \Drupal::translation()->formatPlural(count($users), 'Unable to find user: @users', 'Unable to find users: @users', array('@users' => implode(', ', $users)));
 | 
				
			||||||
    $this->assertNoRaw($message);
 | 
					    $this->assertNoRaw($message);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -141,7 +141,7 @@ class HandlerFilterUserNameTest extends ViewTestBase {
 | 
				
			||||||
    $users = array_map('strtolower', $users);
 | 
					    $users = array_map('strtolower', $users);
 | 
				
			||||||
    $options['query']['uid'] = implode(', ', $users);
 | 
					    $options['query']['uid'] = implode(', ', $users);
 | 
				
			||||||
    $this->drupalGet($path, $options);
 | 
					    $this->drupalGet($path, $options);
 | 
				
			||||||
    $message = format_plural(count($users), 'Unable to find user: @users', 'Unable to find users: @users', array('@users' => implode(', ', $users)));
 | 
					    $message = \Drupal::translation()->formatPlural(count($users), 'Unable to find user: @users', 'Unable to find users: @users', array('@users' => implode(', ', $users)));
 | 
				
			||||||
    $this->assertRaw($message);
 | 
					    $this->assertRaw($message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Pass in an invalid username and a valid username.
 | 
					    // Pass in an invalid username and a valid username.
 | 
				
			||||||
| 
						 | 
					@ -151,7 +151,7 @@ class HandlerFilterUserNameTest extends ViewTestBase {
 | 
				
			||||||
    $users = array($users[0]);
 | 
					    $users = array($users[0]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $this->drupalGet($path, $options);
 | 
					    $this->drupalGet($path, $options);
 | 
				
			||||||
    $message = format_plural(count($users), 'Unable to find user: @users', 'Unable to find users: @users', array('@users' => implode(', ', $users)));
 | 
					    $message = \Drupal::translation()->formatPlural(count($users), 'Unable to find user: @users', 'Unable to find users: @users', array('@users' => implode(', ', $users)));
 | 
				
			||||||
    $this->assertRaw($message);
 | 
					    $this->assertRaw($message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Pass in just valid usernames.
 | 
					    // Pass in just valid usernames.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -150,7 +150,7 @@ class Numeric extends FieldPluginBase {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Should we format as a plural.
 | 
					    // Should we format as a plural.
 | 
				
			||||||
    if (!empty($this->options['format_plural'])) {
 | 
					    if (!empty($this->options['format_plural'])) {
 | 
				
			||||||
      $value = format_plural($value, $this->options['format_plural_singular'], $this->options['format_plural_plural']);
 | 
					      $value = $this->formatPlural($value, $this->options['format_plural_singular'], $this->options['format_plural_plural']);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return $this->sanitizeValue($this->options['prefix'], 'xss')
 | 
					    return $this->sanitizeValue($this->options['prefix'], 'xss')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,9 +73,9 @@ class Full extends SqlBase {
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  public function summaryTitle() {
 | 
					  public function summaryTitle() {
 | 
				
			||||||
    if (!empty($this->options['offset'])) {
 | 
					    if (!empty($this->options['offset'])) {
 | 
				
			||||||
      return format_plural($this->options['items_per_page'], '@count item, skip @skip', 'Paged, @count items, skip @skip', array('@count' => $this->options['items_per_page'], '@skip' => $this->options['offset']));
 | 
					      return $this->formatPlural($this->options['items_per_page'], '@count item, skip @skip', 'Paged, @count items, skip @skip', array('@count' => $this->options['items_per_page'], '@skip' => $this->options['offset']));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return format_plural($this->options['items_per_page'], '@count item', 'Paged, @count items', array('@count' => $this->options['items_per_page']));
 | 
					    return $this->formatPlural($this->options['items_per_page'], '@count item', 'Paged, @count items', array('@count' => $this->options['items_per_page']));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,9 +41,9 @@ class Mini extends SqlBase {
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  public function summaryTitle() {
 | 
					  public function summaryTitle() {
 | 
				
			||||||
    if (!empty($this->options['offset'])) {
 | 
					    if (!empty($this->options['offset'])) {
 | 
				
			||||||
      return format_plural($this->options['items_per_page'], 'Mini pager, @count item, skip @skip', 'Mini pager, @count items, skip @skip', array('@count' => $this->options['items_per_page'], '@skip' => $this->options['offset']));
 | 
					      return $this->formatPlural($this->options['items_per_page'], 'Mini pager, @count item, skip @skip', 'Mini pager, @count items, skip @skip', array('@count' => $this->options['items_per_page'], '@skip' => $this->options['offset']));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
      return format_plural($this->options['items_per_page'], 'Mini pager, @count item', 'Mini pager, @count items', array('@count' => $this->options['items_per_page']));
 | 
					      return $this->formatPlural($this->options['items_per_page'], 'Mini pager, @count item', 'Mini pager, @count items', array('@count' => $this->options['items_per_page']));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,9 +25,9 @@ class Some extends PagerPluginBase {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public function summaryTitle() {
 | 
					  public function summaryTitle() {
 | 
				
			||||||
    if (!empty($this->options['offset'])) {
 | 
					    if (!empty($this->options['offset'])) {
 | 
				
			||||||
      return format_plural($this->options['items_per_page'], '@count item, skip @skip', '@count items, skip @skip', array('@count' => $this->options['items_per_page'], '@skip' => $this->options['offset']));
 | 
					      return $this->formatPlural($this->options['items_per_page'], '@count item, skip @skip', '@count items, skip @skip', array('@count' => $this->options['items_per_page'], '@skip' => $this->options['offset']));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
      return format_plural($this->options['items_per_page'], '@count item', '@count items', array('@count' => $this->options['items_per_page']));
 | 
					      return $this->formatPlural($this->options['items_per_page'], '@count item', '@count items', array('@count' => $this->options['items_per_page']));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  protected function defineOptions() {
 | 
					  protected function defineOptions() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,7 +80,7 @@ function template_preprocess_views_ui_view_info(&$variables) {
 | 
				
			||||||
    $displays = t('None');
 | 
					    $displays = t('None');
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
    $displays = format_plural(count($variables['displays']), 'Display', 'Displays') . ': <em>';
 | 
					    $displays = \Drupal::translation()->formatPlural(count($variables['displays']), 'Display', 'Displays') . ': <em>';
 | 
				
			||||||
    $separator = '';
 | 
					    $separator = '';
 | 
				
			||||||
    foreach ($variables['displays'] as $displays_item) {
 | 
					    foreach ($variables['displays'] as $displays_item) {
 | 
				
			||||||
      $displays .= $separator . SafeMarkup::escape($displays_item);
 | 
					      $displays .= $separator . SafeMarkup::escape($displays_item);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue