diff --git a/core/includes/common.inc b/core/includes/common.inc index ecdb9df..b4b3423 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -458,12 +458,12 @@ function format_xml_elements($array) { * * For example: * @code - * $output = format_plural($node->comment_count, '1 comment', '@count comments'); + * $output = \Drupal::translation()->formatPlural($node->comment_count, '1 comment', '@count comments'); * @endcode * * Example with additional replacements: * @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 @count posts from %old-type to %new-type.', * array('%old-type' => $info->old_type, '%new-type' => $info->new_type)); diff --git a/core/includes/form.inc b/core/includes/form.inc index 5aafe81..37a1c54 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -773,7 +773,7 @@ function template_preprocess_form_element_label(&$variables) { * // The 'success' parameter means no fatal PHP errors were detected. All * // other error management should be handled using 'results'. * 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 { * $message = t('Finished with an error.'); diff --git a/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php b/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php index efb6030..85a6e3f 100644 --- a/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php +++ b/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php @@ -12,8 +12,8 @@ * * 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 use the global functions t() and format_plural(). This allows string - * extractor tools to find translatable strings. + * must use the global functions t() and \Drupal::translation()->formatPlural(). + * This allows string extractor tools to find translatable strings. * * If the class is capable of injecting services from the container, it should * inject the 'string_translation' service and assign it to diff --git a/core/misc/drupal.js b/core/misc/drupal.js index ce13994..37a2df0 100644 --- a/core/misc/drupal.js +++ b/core/misc/drupal.js @@ -336,8 +336,8 @@ if (window.jQuery) { * Drupal.t() is called by this function, make sure not to pass * already-localized strings to it. * - * See the documentation of the server-side format_plural() function for - * further details. + * See the documentation of the server-side \Drupal::translation()->formatPlural() + * function for further details. * * @param {Number} count * The item count to display. diff --git a/core/modules/locale/src/Tests/LocalePluralFormatTest.php b/core/modules/locale/src/Tests/LocalePluralFormatTest.php index a6dd6f0..f11e9a8 100644 --- a/core/modules/locale/src/Tests/LocalePluralFormatTest.php +++ b/core/modules/locale/src/Tests/LocalePluralFormatTest.php @@ -34,7 +34,7 @@ protected function setUp() { } /** - * Tests locale_get_plural() and format_plural() functionality. + * Tests locale_get_plural() and \Drupal::translation()->formatPlural() functionality. */ public function testGetPluralFormat() { // Import some .po files with formulas to set up the environment. diff --git a/core/modules/search/src/Tests/SearchMultilingualEntityTest.php b/core/modules/search/src/Tests/SearchMultilingualEntityTest.php index 832200e..904de8d 100644 --- a/core/modules/search/src/Tests/SearchMultilingualEntityTest.php +++ b/core/modules/search/src/Tests/SearchMultilingualEntityTest.php @@ -235,7 +235,7 @@ protected function assertIndexCounts($remaining, $total, $message) { $this->assertEqual($status['total'], $total, 'Total items ' . $message . ' is ' . $total); // 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::translation()->formatPlural(), so it tests for fragments of text. $indexed = $total - $remaining; $percent = ($total > 0) ? floor(100 * $indexed / $total) : 100; $this->drupalGet('admin/config/search/pages');