Skip to content
Snippets Groups Projects
Commit f758884f authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2319233 by Sutharsan, subhojit777, sardara, lauriii, andythomnz: Double...

Issue #2319233 by Sutharsan, subhojit777, sardara, lauriii, andythomnz: Double escaped string on Available translation update page
parent b0faab25
No related branches found
No related tags found
No related merge requests found
......@@ -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(
......
......@@ -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');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment