diff --git a/core/modules/locale/locale.pages.inc b/core/modules/locale/locale.pages.inc index f5c5b9a62082215b2fff323bd32d89c063722066..596df9711ebeea330ad7975d305b763a9016db6a 100644 --- a/core/modules/locale/locale.pages.inc +++ b/core/modules/locale/locale.pages.inc @@ -6,6 +6,7 @@ */ use Drupal\Component\Utility\SafeMarkup; +use Drupal\Component\Utility\String; use Drupal\Core\Url; use Drupal\Core\Render\Element; use Drupal\locale\SourceString; @@ -60,7 +61,10 @@ function template_preprocess_locale_translation_update_info(array &$variables) { if ($variables['updates']) { foreach ($variables['updates'] as $update) { $modules[] = $update['name']; - $releases[] = t('@module (@date)', array('@module' => $update['name'], '@date' => format_date($update['timestamp'], 'html_date'))); + $releases[] = String::format('@module (@date)', array( + '@module' => $update['name'], + '@date' => format_date($update['timestamp'], 'html_date'), + )); } $variables['modules'] = $modules; } @@ -77,7 +81,11 @@ function template_preprocess_locale_translation_update_info(array &$variables) { if ($variables['not_found']) { foreach ($variables['not_found'] as $update) { $version = $update['version'] ? $update['version'] : t('no version'); - $releases[] = t('@module (@version).', array('@module' => $update['name'], '@version' => $version)) . ' ' . $update['info']; + $releases[] = String::format('@module (@version). !info', array( + '@module' => $update['name'], + '@version' => $version, + '!info' => $update['info'], + )); } } $details['missing_updates_list'] = array( diff --git a/core/modules/locale/src/Tests/LocaleUpdateInterfaceTest.php b/core/modules/locale/src/Tests/LocaleUpdateInterfaceTest.php index c790cd1276db202fc0eac27ff476f8675d9d6424..248e35c90f5258a6f7f948efe9c8a7c814455243 100644 --- a/core/modules/locale/src/Tests/LocaleUpdateInterfaceTest.php +++ b/core/modules/locale/src/Tests/LocaleUpdateInterfaceTest.php @@ -7,6 +7,8 @@ namespace Drupal\locale\Tests; +use Drupal\Component\Utility\String; + /** * Tests for the user interface of project interface translations. * @@ -85,7 +87,7 @@ public function testInterface() { $this->assertRaw(t('Missing translations for: @languages. See the <a href="@updates">Available translation updates</a> page for more information.', array('@languages' => t('German'), '@updates' => \Drupal::url('locale.translate_status'))), 'Missing translations message'); $this->drupalGet('admin/reports/translations'); $this->assertText(t('Missing translations for one project'), 'No translations found'); - $this->assertText(t('@module (@version).', array('@module' => 'Locale test translate', '@version' => '1.3-dev')), 'Release details'); + $this->assertText(String::format('@module (@version). !info', array('@module' => 'Locale test translate', '@version' => '1.3-dev', '!info' => t('No translation files are provided for development releases.'))), 'Release details'); $this->assertText(t('No translation files are provided for development releases.'), 'Release info'); // Override Drupal core translation status as 'no translations found'. @@ -110,7 +112,7 @@ public function testInterface() { // Check if translations are available for Drupal core. $this->drupalGet('admin/reports/translations'); $this->assertText(t('Updates for: !project', array('!project' => t('Drupal core'))), 'Translations found'); - $this->assertText(t('@module (@date)', array('@module' => t('Drupal core'), '@date' => format_date(REQUEST_TIME, 'html_date'))), 'Core translation update'); + $this->assertText(String::format('@module (@date)', array('@module' => t('Drupal core'), '@date' => format_date(REQUEST_TIME, 'html_date'))), 'Core translation update'); $update_button = $this->xpath('//input[@type="submit"][@value="' . t('Update translations') . '"]'); $this->assertTrue($update_button, 'Update translations button'); }