diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php
index c55927f..3800a79 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php
@@ -124,7 +124,7 @@ function testContentTypeLanguageConfiguration() {
     // Edit the content and ensure correct language is selected.
     $path = 'node/' . $node->nid . '/edit';
     $this->drupalGet($path);
-    $this->assertRaw('<option value="' . $langcode . '" selected="selected">' .  $name . '</option>', t('Correct language selected.'));
+    $this->assertRaw('<option value="' . $langcode . '" selected="selected">' .  $name . '</option>', 'Correct language selected.');
     // Ensure we can change the node language.
     $edit = array(
       'langcode' => 'en',
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleExportTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleExportTest.php
index 954e74d..ba4c186 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleExportTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleExportTest.php
@@ -65,9 +65,9 @@ function testExportTranslation() {
     ), t('Export'));
 
     // Ensure we have a translation file.
-    $this->assertRaw('# French translation of Drupal', t('Exported French translation file.'));
+    $this->assertRaw('# French translation of Drupal', 'Exported French translation file.');
     // Ensure our imported translations exist in the file.
-    $this->assertRaw('msgstr "lundi"', t('French translations present in exported file.'));
+    $this->assertRaw('msgstr "lundi"', 'French translations present in exported file.');
 
     // Import some more French translations which will be marked as customized.
     $name = tempnam('temporary://', "po2_") . '.po';
@@ -95,11 +95,11 @@ function testExportTranslation() {
     ), t('Export'));
 
     // Ensure we have a translation file.
-    $this->assertRaw('# French translation of Drupal', t('Exported French translation file with only customized strings.'));
+    $this->assertRaw('# French translation of Drupal', 'Exported French translation file with only customized strings.');
     // Ensure the customized translations exist in the file.
-    $this->assertRaw('msgstr "janvier"', t('French custom translation present in exported file.'));
+    $this->assertRaw('msgstr "janvier"', 'French custom translation present in exported file.');
     // Ensure no untranslated strings exist in the file.
-    $this->assertNoRaw('msgid "February"', t('Untranslated string not present in exported file.'));
+    $this->assertNoRaw('msgid "February"', 'Untranslated string not present in exported file.');
 
     // Export only untranslated French translations.
     $this->drupalPost('admin/config/regional/translate/export', array(
@@ -110,11 +110,11 @@ function testExportTranslation() {
     ), t('Export'));
 
     // Ensure we have a translation file.
-    $this->assertRaw('# French translation of Drupal', t('Exported French translation file with only untranslated strings.'));
+    $this->assertRaw('# French translation of Drupal', 'Exported French translation file with only untranslated strings.');
     // Ensure no customized translations exist in the file.
-    $this->assertNoRaw('msgstr "janvier"', t('French custom translation not present in exported file.'));
+    $this->assertNoRaw('msgstr "janvier"', 'French custom translation not present in exported file.');
     // Ensure the untranslated strings exist in the file.
-    $this->assertRaw('msgid "February"', t('Untranslated string present in exported file.'));
+    $this->assertRaw('msgid "February"', 'Untranslated string present in exported file.');
   }
 
   /**
@@ -128,7 +128,7 @@ function testExportTranslationTemplateFile() {
     // Get the translation template file.
     $this->drupalPost('admin/config/regional/translate/export', array(), t('Export'));
     // Ensure we have a translation file.
-    $this->assertRaw('# LANGUAGE translation of PROJECT', t('Exported translation template file.'));
+    $this->assertRaw('# LANGUAGE translation of PROJECT', 'Exported translation template file.');
   }
 
   /**
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php
index fcc74d0..198207b 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php
@@ -55,17 +55,17 @@ function testStandalonePoFile() {
     ));
     $config = config('locale.settings');
     // The import should automatically create the corresponding language.
-    $this->assertRaw(t('The language %language has been created.', array('%language' => 'French')), t('The language has been automatically created.'));
+    $this->assertRaw(t('The language %language has been created.', array('%language' => 'French')), 'The language has been automatically created.');
 
     // The import should have created 8 strings.
-    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 8, '%update' => 0, '%delete' => 0)), t('The translation file was successfully imported.'));
+    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 8, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
 
     // This import should have saved plural forms to have 2 variants.
     $locale_plurals = \Drupal::state()->get('locale.translation.plurals') ?: array();
-    $this->assert($locale_plurals['fr']['plurals'] == 2, t('Plural number initialized.'));
+    $this->assert($locale_plurals['fr']['plurals'] == 2, 'Plural number initialized.');
 
     // Ensure we were redirected correctly.
-    $this->assertEqual($this->getUrl(), url('admin/config/regional/translate', array('absolute' => TRUE)), t('Correct page redirection.'));
+    $this->assertEqual($this->getUrl(), url('admin/config/regional/translate', array('absolute' => TRUE)), 'Correct page redirection.');
 
 
     // Try importing a .po file with invalid tags.
@@ -74,10 +74,10 @@ function testStandalonePoFile() {
     ));
 
     // The import should have created 1 string and rejected 2.
-    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), t('The translation file was successfully imported.'));
+    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
 
     $skip_message = format_plural(2, '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' => url('admin/reports/dblog')));
-    $this->assertRaw($skip_message, t('Unsafe strings were skipped.'));
+    $this->assertRaw($skip_message, 'Unsafe strings were skipped.');
 
     // Try importing a zero byte sized .po file.
     $this->importPoFile($this->getEmptyPoFile(), array(
@@ -93,8 +93,8 @@ function testStandalonePoFile() {
       'langcode' => 'fr',
       'files[file]' => $name,
     ), t('Import'));
-    $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/import', array('absolute' => TRUE)), t('Correct page redirection.'));
-    $this->assertText(t('File to import not found.'), t('File to import not found message.'));
+    $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/import', array('absolute' => TRUE)), 'Correct page redirection.');
+    $this->assertText(t('File to import not found.'), 'File to import not found message.');
 
 
     // Try importing a .po file with overriding strings, and ensure existing
@@ -104,7 +104,7 @@ function testStandalonePoFile() {
     ));
 
     // The import should have created 1 string.
-    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), t('The translation file was successfully imported.'));
+    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
     // Ensure string wasn't overwritten.
     $search = array(
       'string' => 'Montag',
@@ -112,11 +112,11 @@ function testStandalonePoFile() {
       'translation' => 'translated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), t('String not overwritten by imported string.'));
+    $this->assertText(t('No strings available.'), 'String not overwritten by imported string.');
 
     // This import should not have changed number of plural forms.
     $locale_plurals = \Drupal::state()->get('locale.translation.plurals') ?: array();
-    $this->assert($locale_plurals['fr']['plurals'] == 2, t('Plural numbers untouched.'));
+    $this->assert($locale_plurals['fr']['plurals'] == 2, 'Plural numbers untouched.');
 
     // Try importing a .po file with overriding strings, and ensure existing
     // strings are overwritten.
@@ -126,7 +126,7 @@ function testStandalonePoFile() {
     ));
 
     // The import should have updated 2 strings.
-    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 0, '%update' => 2, '%delete' => 0)), t('The translation file was successfully imported.'));
+    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 0, '%update' => 2, '%delete' => 0)), 'The translation file was successfully imported.');
     // Ensure string was overwritten.
     $search = array(
       'string' => 'Montag',
@@ -134,10 +134,10 @@ function testStandalonePoFile() {
       'translation' => 'translated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertNoText(t('No strings available.'), t('String overwritten by imported string.'));
+    $this->assertNoText(t('No strings available.'), 'String overwritten by imported string.');
     // This import should have changed number of plural forms.
     $locale_plurals = \Drupal::state()->get('locale.translation.plurals') ?: array();
-    $this->assert($locale_plurals['fr']['plurals'] == 3, t('Plural numbers changed.'));
+    $this->assert($locale_plurals['fr']['plurals'] == 3, 'Plural numbers changed.');
 
     // Importing a .po file and mark its strings as customized strings.
     $this->importPoFile($this->getCustomPoFile(), array(
@@ -146,12 +146,12 @@ function testStandalonePoFile() {
     ));
 
     // The import should have created 6 strings.
-    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 6, '%update' => 0, '%delete' => 0)), t('The customized translation file was successfully imported.'));
+    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 6, '%update' => 0, '%delete' => 0)), 'The customized translation file was successfully imported.');
 
     // The database should now contain 6 customized strings (two imported
     // strings are not translated).
     $count = db_query('SELECT lid FROM {locales_target} WHERE customized = :custom', array(':custom' => 1))->rowCount();
-    $this->assertEqual($count, 6, t('Customized translations succesfully imported.'));
+    $this->assertEqual($count, 6, 'Customized translations succesfully imported.');
 
     // Try importing a .po file with overriding strings, and ensure existing
     // customized strings are kept.
@@ -162,7 +162,7 @@ function testStandalonePoFile() {
     ));
 
     // The import should have created 1 string.
-    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), t('The customized translation file was successfully imported.'));
+    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The customized translation file was successfully imported.');
     // Ensure string wasn't overwritten.
     $search = array(
       'string' => 'januari',
@@ -170,7 +170,7 @@ function testStandalonePoFile() {
       'translation' => 'translated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), t('Customized string not overwritten by imported string.'));
+    $this->assertText(t('No strings available.'), 'Customized string not overwritten by imported string.');
 
     // Try importing a .po file with overriding strings, and ensure existing
     // customized strings are overwritten.
@@ -181,7 +181,7 @@ function testStandalonePoFile() {
     ));
 
     // The import should have updated 2 strings.
-    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 0, '%update' => 2, '%delete' => 0)), t('The customized translation file was successfully imported.'));
+    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 0, '%update' => 2, '%delete' => 0)), 'The customized translation file was successfully imported.');
     // Ensure string was overwritten.
     $search = array(
       'string' => 'januari',
@@ -189,7 +189,7 @@ function testStandalonePoFile() {
       'translation' => 'translated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertNoText(t('No strings available.'), t('Customized string overwritten by imported string.'));
+    $this->assertNoText(t('No strings available.'), 'Customized string overwritten by imported string.');
 
   }
 
@@ -202,8 +202,8 @@ function testLanguageContext() {
       'langcode' => 'hr',
     ));
 
-    $this->assertIdentical(t('May', array(), array('langcode' => 'hr', 'context' => 'Long month name')), 'Svibanj', t('Long month name context is working.'));
-    $this->assertIdentical(t('May', array(), array('langcode' => 'hr')), 'Svi.', t('Default context is working.'));
+    $this->assertIdentical(t('May', array(), array('langcode' => 'hr', 'context' => 'Long month name')), 'Svibanj', 'Long month name context is working.');
+    $this->assertIdentical(t('May', array(), array('langcode' => 'hr')), 'Svi.', 'Default context is working.');
   }
 
   /**
@@ -217,15 +217,15 @@ function testEmptyMsgstr() {
       'langcode' => $langcode,
     ));
 
-    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), t('The translation file was successfully imported.'));
-    $this->assertIdentical(t('Operations', array(), array('langcode' => $langcode)), 'Műveletek', t('String imported and translated.'));
+    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
+    $this->assertIdentical(t('Operations', array(), array('langcode' => $langcode)), 'Műveletek', 'String imported and translated.');
 
     // Try importing a .po file.
     $this->importPoFile($this->getPoFileWithEmptyMsgstr(), array(
       'langcode' => $langcode,
       'overwrite_options[not_customized]' => TRUE,
     ));
-    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 0, '%update' => 0, '%delete' => 1)), t('The translation file was successfully imported.'));
+    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 0, '%update' => 0, '%delete' => 1)), 'The translation file was successfully imported.');
 
     $str = "Operations";
     $search = array(
@@ -234,7 +234,7 @@ function testEmptyMsgstr() {
       'translation' => 'untranslated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertText($str, t('Search found the string as untranslated.'));
+    $this->assertText($str, 'Search found the string as untranslated.');
   }
 
   /**
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleJavascriptTranslation.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleJavascriptTranslation.php
index de5dd08..9ad0439 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleJavascriptTranslation.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleJavascriptTranslation.php
@@ -96,12 +96,17 @@ function testFileParsing() {
       $args = array('%source' => $str, '%context' => $context);
 
       // Make sure that the string was found in the file.
-      $this->assertTrue(isset($source_strings[$str]), t("Found source string: %source", $args));
+      $this->assertTrue(isset($source_strings[$str]), format_string("Found source string: %source", $args));
 
       // Make sure that the proper context was matched.
-      $this->assertTrue(isset($source_strings[$str]) && $source_strings[$str] === $context, strlen($context) > 0 ? t("Context for %source is %context", $args) : t("Context for %source is blank", $args));
+     $test = isset($source_strings[$str]) && $source_strings[$str] === $context;
+      if (strlen($context) > 0) {
+        $this->assertTrue($test, format_string('Context for %source is %context', $args));
+      }
+      else {
+        $this->assertTrue($test, format_string('Context for %source is blank', $args));
+      }
     }
-
-    $this->assertEqual(count($source_strings), count($test_strings), t("Found correct number of source strings."));
+    $this->assertEqual(count($source_strings), count($test_strings), "Found correct number of source strings.");
   }
 }
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php
index 0581124..912d657 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php
@@ -38,6 +38,6 @@ public static function getInfo() {
   public function testLibraryInfoAlter() {
     drupal_add_library('system', 'jquery.ui.datepicker');
     $scripts = drupal_get_js();
-    $this->assertTrue(strpos($scripts, 'locale.datepicker.js'), t('locale.datepicker.js added to scripts.'));
+    $this->assertTrue(strpos($scripts, 'locale.datepicker.js'), 'locale.datepicker.js added to scripts.');
   }
 }
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php
index 77b27c8..e21b09d 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php
@@ -69,7 +69,7 @@ function testPathLanguageConfiguration() {
     // Check that the "xx" front page is readily available because path prefix
     // negotiation is pre-configured.
     $this->drupalGet($prefix);
-    $this->assertText(t('Welcome to Drupal'), t('The "xx" front page is readibly available.'));
+    $this->assertText(t('Welcome to Drupal'), 'The "xx" front page is readibly available.');
 
     // Create a node.
     $node = $this->drupalCreateNode(array('type' => 'page'));
@@ -95,11 +95,11 @@ function testPathLanguageConfiguration() {
 
     // Confirm English language path alias works.
     $this->drupalGet($english_path);
-    $this->assertText($node->label(), t('English alias works.'));
+    $this->assertText($node->label(), 'English alias works.');
 
     // Confirm custom language path alias works.
     $this->drupalGet($prefix . '/' . $custom_language_path);
-    $this->assertText($node->label(), t('Custom language alias works.'));
+    $this->assertText($node->label(), 'Custom language alias works.');
 
     // Create a custom path.
     $custom_path = $this->randomName(8);
@@ -112,10 +112,10 @@ function testPathLanguageConfiguration() {
     );
     $this->container->get('path.crud')->save($edit['source'], $edit['alias'], $edit['langcode']);
     $lookup_path = $this->container->get('path.alias_manager')->getPathAlias('node/' . $node->nid, 'en');
-    $this->assertEqual($english_path, $lookup_path, t('English language alias has priority.'));
+    $this->assertEqual($english_path, $lookup_path, 'English language alias has priority.');
     // Same check for language 'xx'.
     $lookup_path = $this->container->get('path.alias_manager')->getPathAlias('node/' . $node->nid, $prefix);
-    $this->assertEqual($custom_language_path, $lookup_path, t('Custom language alias has priority.'));
+    $this->assertEqual($custom_language_path, $lookup_path, 'Custom language alias has priority.');
     $this->container->get('path.crud')->delete($edit);
 
     // Create language nodes to check priority of aliases.
@@ -142,17 +142,17 @@ function testPathLanguageConfiguration() {
     $this->drupalGet('<front>');
     $custom_path_url = base_path() . $GLOBALS['script_path'] . $custom_path;
     $elements = $this->xpath('//a[@href=:href and .=:title]', array(':href' => $custom_path_url, ':title' => $first_node->label()));
-    $this->assertTrue(!empty($elements), t('First node links to the path alias.'));
+    $this->assertTrue(!empty($elements), 'First node links to the path alias.');
     $elements = $this->xpath('//a[@href=:href and .=:title]', array(':href' => $custom_path_url, ':title' => $second_node->label()));
-    $this->assertTrue(!empty($elements), t('Second node links to the path alias.'));
+    $this->assertTrue(!empty($elements), 'Second node links to the path alias.');
 
     // Confirm that the custom path leads to the first node.
     $this->drupalGet($custom_path);
-    $this->assertText($first_node->label(), t('Custom alias returns first node.'));
+    $this->assertText($first_node->label(), 'Custom alias returns first node.');
 
     // Confirm that the custom path with prefix leads to the second node.
     $this->drupalGet($prefix . '/' . $custom_path);
-    $this->assertText($second_node->label(), t('Custom alias with prefix returns second node.'));
+    $this->assertText($second_node->label(), 'Custom alias with prefix returns second node.');
 
   }
 }
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php
index d7ce9ab..15a1c55 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php
@@ -149,9 +149,9 @@ function testPluralEditExport() {
       'langcode' => 'fr',
     ), t('Export'));
     // Ensure we have a translation file.
-    $this->assertRaw('# French translation of Drupal', t('Exported French translation file.'));
+    $this->assertRaw('# French translation of Drupal', 'Exported French translation file.');
     // Ensure our imported translations exist in the file.
-    $this->assertRaw("msgid \"Monday\"\nmsgstr \"lundi\"", t('French translations present in exported file.'));
+    $this->assertRaw("msgid \"Monday\"\nmsgstr \"lundi\"", 'French translations present in exported file.');
     // Check for plural export specifically.
     $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count heure\"\nmsgstr[1] \"@count heures\"", 'Plural translations exported properly.');
 
@@ -160,11 +160,11 @@ function testPluralEditExport() {
       'langcode' => 'hr',
     ), t('Export'));
     // Ensure we have a translation file.
-    $this->assertRaw('# Croatian translation of Drupal', t('Exported Croatian translation file.'));
+    $this->assertRaw('# Croatian translation of Drupal', 'Exported Croatian translation file.');
     // Ensure our imported translations exist in the file.
-    $this->assertRaw("msgid \"Monday\"\nmsgstr \"Ponedjeljak\"", t('Croatian translations present in exported file.'));
+    $this->assertRaw("msgid \"Monday\"\nmsgstr \"Ponedjeljak\"", 'Croatian translations present in exported file.');
     // Check for plural export specifically.
-    $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata\"\nmsgstr[2] \"@count sati\"", t('Plural translations exported properly.'));
+    $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata\"\nmsgstr[2] \"@count sati\"", 'Plural translations exported properly.');
 
     // Check if the source appears on the translation page.
     $this->drupalGet('admin/config/regional/translate');
@@ -250,15 +250,15 @@ function testPluralEditExport() {
     ), t('Export'));
     // Check for plural export specifically.
     $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count heure edited\"\nmsgstr[1] \"@count heures\"", 'Edited French plural translations for hours exported properly.');
-    $this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"1 jour\"\nmsgstr[1] \"@count jours\"", t('Added French plural translations for days exported properly.'));
+    $this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"1 jour\"\nmsgstr[1] \"@count jours\"", 'Added French plural translations for days exported properly.');
 
     // Get the Croatian translations.
     $this->drupalPost('admin/config/regional/translate/export', array(
       'langcode' => 'hr',
     ), t('Export'));
     // Check for plural export specifically.
-    $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata edited\"\nmsgstr[2] \"@count sati\"", t('Edited Croatian plural translations exported properly.'));
-    $this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"@count dan\"\nmsgstr[1] \"@count dana\"\nmsgstr[2] \"@count dana\"", t('Added Croatian plural translations exported properly.'));
+    $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata edited\"\nmsgstr[2] \"@count sati\"", 'Edited Croatian plural translations exported properly.');
+    $this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"@count dan\"\nmsgstr[1] \"@count dana\"\nmsgstr[2] \"@count dana\"", 'Added Croatian plural translations exported properly.');
   }
 
   /**
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php
index 63ef579..3f58726 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php
@@ -38,7 +38,7 @@ function testEnglishTranslation() {
     $this->drupalLogin($admin_user);
 
     $this->drupalPost('admin/config/regional/language/edit/en', array('locale_translate_english' => TRUE), t('Save language'));
-    $this->assertLinkByHref('/admin/config/regional/translate/translate?langcode=en', 0, t('Enabled interface translation to English.'));
+    $this->assertLinkByHref('/admin/config/regional/translate/translate?langcode=en', 0, 'Enabled interface translation to English.');
   }
 
   /**
@@ -75,8 +75,8 @@ function testStringTranslation() {
     t($name, array(), array('langcode' => $langcode));
     // Reset locale cache.
     $this->container->get('string_translation')->reset();
-    $this->assertRaw('"edit-languages-' . $langcode .'-weight"', t('Language code found.'));
-    $this->assertText(t($name), t('Test language added.'));
+    $this->assertRaw('"edit-languages-' . $langcode .'-weight"', 'Language code found.');
+    $this->assertText(t($name), 'Test language added.');
     $this->drupalLogout();
 
     // Search for the name and translate it.
@@ -87,7 +87,7 @@ function testStringTranslation() {
       'translation' => 'untranslated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertText($name, t('Search found the string as untranslated.'));
+    $this->assertText($name, 'Search found the string as untranslated.');
 
     // Assume this is the only result, given the random name.
     // We save the lid from the path.
@@ -97,15 +97,15 @@ function testStringTranslation() {
       $lid => $this->randomName(),
     );
     // No t() here, it's surely not translated yet.
-    $this->assertText($name, t('name found on edit screen.'));
-    $this->assertNoOption('edit-langcode', 'en', t('No way to translate the string to English.'));
+    $this->assertText($name, 'name found on edit screen.');
+    $this->assertNoOption('edit-langcode', 'en', 'No way to translate the string to English.');
     $this->drupalLogout();
     $this->drupalLogin($admin_user);
     $this->drupalPost('admin/config/regional/language/edit/en', array('locale_translate_english' => TRUE), t('Save language'));
     $this->drupalLogout();
     $this->drupalLogin($translate_user);
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertText($name, t('Search found the string as untranslated.'));
+    $this->assertText($name, 'Search found the string as untranslated.');
 
     // Assume this is the only result, given the random name.
     $textarea = current($this->xpath('//textarea'));
@@ -114,15 +114,15 @@ function testStringTranslation() {
       $lid => $translation,
     );
     $this->drupalPost('admin/config/regional/translate/translate', $edit, t('Save translations'));
-    $this->assertText(t('The strings have been saved.'), t('The strings have been saved.'));
-    $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), t('Correct page redirection.'));
+    $this->assertText(t('The strings have been saved.'), 'The strings have been saved.');
+    $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), 'Correct page redirection.');
     $search = array(
       'string' => $name,
       'langcode' => $langcode,
       'translation' => 'translated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertRaw($translation, t('Non-English translation properly saved.'));
+    $this->assertRaw($translation, 'Non-English translation properly saved.');
 
 
     $search = array(
@@ -143,19 +143,19 @@ function testStringTranslation() {
       'translation' => 'translated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertRaw($translation_to_en, t('English translation properly saved.'));
+    $this->assertRaw($translation_to_en, 'English translation properly saved.');
 
     // Reset the tag cache on the tester side in order to pick up the call to
     // cache()->deleteTags() on the tested side.
     drupal_static_reset('Drupal\Core\Cache\CacheBackendInterface::tagCache');
 
-    $this->assertTrue($name != $translation && t($name, array(), array('langcode' => $langcode)) == $translation, t('t() works for non-English.'));
+    $this->assertTrue($name != $translation && t($name, array(), array('langcode' => $langcode)) == $translation, 't() works for non-English.');
     // Refresh the locale() cache to get fresh data from t() below. We are in
     // the same HTTP request and therefore t() is not refreshed by saving the
     // translation above.
     $this->container->get('string_translation')->reset();
     // Now we should get the proper fresh translation from t().
-    $this->assertTrue($name != $translation_to_en && t($name, array(), array('langcode' => 'en')) == $translation_to_en, t('t() works for English.'));
+    $this->assertTrue($name != $translation_to_en && t($name, array(), array('langcode' => 'en')) == $translation_to_en, 't() works for English.');
     $this->assertTrue(t($name, array(), array('langcode' => Language::LANGCODE_SYSTEM)) == $name, 't() works for Language::LANGCODE_SYSTEM.');
 
     $search = array(
@@ -164,7 +164,7 @@ function testStringTranslation() {
       'translation' => 'untranslated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), t('String is translated.'));
+    $this->assertText(t('No strings available.'), 'String is translated.');
 
     $this->drupalLogout();
 
@@ -175,11 +175,11 @@ function testStringTranslation() {
     $this->drupalPost($path, array(), t('Delete'));
     // We need raw here because %language and %langcode will add HTML.
     $t_args = array('%language' => $name, '%langcode' => $langcode);
-    $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), t('The test language has been removed.'));
+    $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The test language has been removed.');
     // Reload to remove $name.
     $this->drupalGet($path);
     // Verify that language is no longer found.
-    $this->assertResponse(404, t('Language no longer found.'));
+    $this->assertResponse(404, 'Language no longer found.');
     $this->drupalLogout();
 
     // Delete the string.
@@ -197,7 +197,7 @@ function testStringTranslation() {
       $lid => '',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $edit, t('Save translations'));
-    $this->assertRaw($name, t('The strings have been saved.'));
+    $this->assertRaw($name, 'The strings have been saved.');
     $this->drupalLogin($translate_user);
     $search = array(
       'string' => $name,
@@ -205,7 +205,7 @@ function testStringTranslation() {
       'translation' => 'untranslated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertNoText(t('No strings available.'), t('The translation has been removed'));
+    $this->assertNoText(t('No strings available.'), 'The translation has been removed');
   }
 
   /*
@@ -261,14 +261,14 @@ function testJavaScriptTranslation() {
 
     $locale_javascripts = \Drupal::state()->get('locale.translation.javascript') ?: array();
     $js_file = 'public://' . $config->get('javascript.directory') . '/' . $langcode . '_' . $locale_javascripts[$langcode] . '.js';
-    $this->assertTrue($result = file_exists($js_file), t('JavaScript file created: %file', array('%file' => $result ? $js_file : t('not found'))));
+    $this->assertTrue($result = file_exists($js_file), format_string('JavaScript file created: %file', array('%file' => $result ? $js_file : 'not found')));
 
     // Test JavaScript translation rebuilding.
     file_unmanaged_delete($js_file);
-    $this->assertTrue($result = !file_exists($js_file), t('JavaScript file deleted: %file', array('%file' => $result ? $js_file : t('found'))));
+    $this->assertTrue($result = !file_exists($js_file), format_string('JavaScript file deleted: %file', array('%file' => $result ? $js_file : 'found')));
     cache_invalidate_tags(array('content' => TRUE));
     _locale_rebuild_js($langcode);
-    $this->assertTrue($result = file_exists($js_file), t('JavaScript file rebuilt: %file', array('%file' => $result ? $js_file : t('not found'))));
+    $this->assertTrue($result = file_exists($js_file), format_string('JavaScript file rebuilt: %file', array('%file' => $result ? $js_file : 'not found')));
   }
 
   /**
@@ -322,8 +322,8 @@ function testStringValidation() {
       $this->drupalPost('admin/config/regional/translate/translate', $edit, t('Save translations'));
       // Check for a form error on the textarea.
       $form_class = $this->xpath('//form[@id="locale-translate-edit-form"]//textarea/@class');
-      $this->assertNotIdentical(FALSE, strpos($form_class[0], 'error'), t('The string was rejected as unsafe.'));
-      $this->assertNoText(t('The string has been saved.'), t('The string was not saved.'));
+      $this->assertNotIdentical(FALSE, strpos($form_class[0], 'error'), 'The string was rejected as unsafe.');
+      $this->assertNoText(t('The string has been saved.'), 'The string was not saved.');
     }
   }
 
@@ -383,7 +383,7 @@ function testStringSearch() {
     // assertText() seems to remove the input field where $name always could be
     // found, so this is not a false assert. See how assertNoText succeeds
     // later.
-    $this->assertText($name, t('Search found the string.'));
+    $this->assertText($name, 'Search found the string.');
 
     // Ensure untranslated string doesn't appear if searching on 'only
     // translated strings'.
@@ -393,7 +393,7 @@ function testStringSearch() {
       'translation' => 'translated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), t("Search didn't find the string."));
+    $this->assertText(t('No strings available.'), "Search didn't find the string.");
 
     // Ensure untranslated string appears if searching on 'only untranslated
     // strings'.
@@ -403,7 +403,7 @@ function testStringSearch() {
       'translation' => 'untranslated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertNoText(t('No strings available.'), t('Search found the string.'));
+    $this->assertNoText(t('No strings available.'), 'Search found the string.');
 
     // Add translation.
     // Assume this is the only result, given the random name.
@@ -423,7 +423,7 @@ function testStringSearch() {
       'translation' => 'translated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertNoText(t('No strings available.'), t('Search found the translation.'));
+    $this->assertNoText(t('No strings available.'), 'Search found the translation.');
 
     // Ensure translated source string doesn't appear if searching on 'only
     // untranslated strings'.
@@ -433,7 +433,7 @@ function testStringSearch() {
       'translation' => 'untranslated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), t("Search didn't find the source string."));
+    $this->assertText(t('No strings available.'), "Search didn't find the source string.");
 
     // Ensure translated string doesn't appear if searching on 'only
     // untranslated strings'.
@@ -443,7 +443,7 @@ function testStringSearch() {
       'translation' => 'untranslated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), t("Search didn't find the translation."));
+    $this->assertText(t('No strings available.'), "Search didn't find the translation.");
 
     // Ensure translated string does appear if searching on the custom language.
     $search = array(
@@ -452,7 +452,7 @@ function testStringSearch() {
       'translation' => 'all',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertNoText(t('No strings available.'), t('Search found the translation.'));
+    $this->assertNoText(t('No strings available.'), 'Search found the translation.');
 
     // Ensure translated string doesn't appear if searching in System (English).
     $search = array(
@@ -461,7 +461,7 @@ function testStringSearch() {
       'translation' => 'all',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), t("Search didn't find the translation."));
+    $this->assertText(t('No strings available.'), "Search didn't find the translation.");
 
     // Search for a string that isn't in the system.
     $unavailable_string = $this->randomName(16);
@@ -471,7 +471,7 @@ function testStringSearch() {
       'translation' => 'all',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), t("Search didn't find the invalid string."));
+    $this->assertText(t('No strings available.'), "Search didn't find the invalid string.");
   }
 
   /**
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php
index c53ed7a..e4bcc6a 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php
@@ -68,7 +68,11 @@ function testUninstallProcess() {
     global $user;
     $user = drupal_anonymous_user();
 
+<<<<<<< HEAD
     $this->assertEqual(language(Language::TYPE_INTERFACE)->id, $this->langcode, t('Current language: %lang', array('%lang' => language(Language::TYPE_INTERFACE)->id)));
+=======
+    $this->assertEqual(language(Language::TYPE_INTERFACE)->langcode, $this->langcode, format_string('Current language: %lang', array('%lang' => language(Language::TYPE_INTERFACE)->langcode)));
+>>>>>>> Rerollong the patch for the locale module https://drupal.org/node/1797364#comment-7573647
 
     // Enable multilingual workflow option for articles.
     language_save_default_configuration('node', 'article', array('langcode' => 'site_default', 'language_show' => TRUE));
@@ -89,7 +93,7 @@ function testUninstallProcess() {
     $config = config('locale.settings');
     $locale_javascripts = \Drupal::state()->get('locale.translation.javascript') ?: array();
     $js_file = 'public://' . $config->get('javascript.directory') . '/fr_' . $locale_javascripts['fr'] . '.js';
-    $this->assertTrue($result = file_exists($js_file), t('JavaScript file created: %file', array('%file' => $result ? $js_file : t('none'))));
+    $this->assertTrue(file_exists($js_file), format_string('JavaScript file created: %file', array('%file' => $js_file)));
 
     // Disable string caching.
     $config->set('cache_strings', 0)->save();
@@ -115,31 +119,35 @@ function testUninstallProcess() {
     // Visit the front page.
     $this->drupalGet('');
     // Check the init language logic.
+<<<<<<< HEAD
     $this->assertEqual(language(Language::TYPE_INTERFACE)->id, 'en', t('Language after uninstall: %lang', array('%lang' => language(Language::TYPE_INTERFACE)->id)));
+=======
+    $this->assertEqual(language(Language::TYPE_INTERFACE)->langcode, 'en', format_string('Language after uninstall: %lang', array('%lang' => language(Language::TYPE_INTERFACE)->langcode)));
+>>>>>>> Rerollong the patch for the locale module https://drupal.org/node/1797364#comment-7573647
 
     // Check JavaScript files deletion.
-    $this->assertTrue($result = !file_exists($js_file), t('JavaScript file deleted: %file', array('%file' => $result ? $js_file : t('found'))));
+    $this->assertFalse(file_exists($js_file), format_string('JavaScript file deleted: %file', array('%file' => $js_file)));
 
     // Check language count.
     $language_count = variable_get('language_count', 1);
-    $this->assertEqual($language_count, 1, t('Language count: %count', array('%count' => $language_count)));
+    $this->assertEqual($language_count, 1, format_string('Language count: %count', array('%count' => $language_count)));
 
     // Check language negotiation.
     require_once DRUPAL_ROOT . '/core/includes/language.inc';
-    $this->assertTrue(count(language_types_get_all()) == count(language_types_get_default()), t('Language types reset'));
+    $this->assertTrue(count(language_types_get_all()) == count(language_types_get_default()), 'Language types reset');
     $language_negotiation = language_negotiation_method_get_first(Language::TYPE_INTERFACE) == LANGUAGE_NEGOTIATION_SELECTED;
-    $this->assertTrue($language_negotiation, t('Interface language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set'))));
+    $this->assertTrue($language_negotiation, format_string('Interface language negotiation: %setting', array('%setting' => $language_negotiation ? 'none' : 'set')));
     $language_negotiation = language_negotiation_method_get_first(Language::TYPE_CONTENT) == LANGUAGE_NEGOTIATION_SELECTED;
-    $this->assertTrue($language_negotiation, t('Content language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set'))));
+    $this->assertTrue($language_negotiation, format_string('Content language negotiation: %setting', array('%setting' => $language_negotiation ? 'none' : 'set')));
     $language_negotiation = language_negotiation_method_get_first(Language::TYPE_URL) == LANGUAGE_NEGOTIATION_SELECTED;
-    $this->assertTrue($language_negotiation, t('URL language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set'))));
+    $this->assertTrue($language_negotiation, format_string('URL language negotiation: %setting', array('%setting' => $language_negotiation ? 'none' : 'set')));
 
     // Check language negotiation method settings.
-    $this->assertFalse(config('language.negotiation')->get('url.source'), t('URL language negotiation method indicator settings cleared.'));
-    $this->assertFalse(config('language.negotiation')->get('session.parameter'), t('Visit language negotiation method settings cleared.'));
+    $this->assertFalse(config('language.negotiation')->get('url.source'), 'URL language negotiation method indicator settings cleared.');
+    $this->assertFalse(config('language.negotiation')->get('session.parameter'), 'Visit language negotiation method settings cleared.');
 
     // Check JavaScript parsed.
     $javascript_parsed_count = count(\Drupal::state()->get('system.javascript_parsed') ?: array());
-    $this->assertEqual($javascript_parsed_count, 0, t('JavaScript parsed count: %count', array('%count' => $javascript_parsed_count)));
+    $this->assertEqual($javascript_parsed_count, 0, format_string('JavaScript parsed count: %count', array('%count' => $javascript_parsed_count)));
   }
 }
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUpdateTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUpdateTest.php
index 44bfabe..870648f 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUpdateTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUpdateTest.php
@@ -38,7 +38,253 @@ function setUp() {
     // We use German as test language. This language must match the translation
     // file that come with the locale_test module (test.de.po) and can therefore
     // not be chosen randomly.
+
     $this->addLanguage('de');
+
+    $this->drupalPost('admin/config/regional/language/add', array('predefined_langcode' => 'de'), t('Add language'));
+
+    // Setup timestamps to identify old and new translation sources.
+    $this->timestamp_old = REQUEST_TIME - 300;
+    $this->timestamp_medium = REQUEST_TIME - 200;
+    $this->timestamp_new = REQUEST_TIME - 100;
+    $this->timestamp_now = REQUEST_TIME;
+  }
+
+  /**
+   * Sets the value of the default translations directory.
+   *
+   * @param string $path
+   *   Path of the translations directory relative to the drupal installation
+   *   directory.
+   */
+  private function setTranslationsDirectory($path) {
+    $this->tranlations_directory = $path;
+    file_prepare_directory($path, FILE_CREATE_DIRECTORY);
+    config('locale.settings')->set('translation.path', $path)->save();
+  }
+
+  /**
+   * Adds a language.
+   *
+   * @param $langcode
+   *   The language code of the language to add.
+   */
+  function addLanguage($langcode) {
+    $edit = array('predefined_langcode' => $langcode);
+    $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
+    drupal_static_reset('language_list');
+    $this->assertTrue(language_load($langcode), format_string('Language %langcode added.', array('%langcode' => $langcode)));
+  }
+
+  /**
+   * Creates a translation file and tests its timestamp.
+   *
+   * @param string $path
+   *   Path of the file relative to the public file path.
+   * @param string $filename
+   *   Name of the file to create.
+   * @param integer $timestamp
+   *   Timestamp to set the file to. Defaults to current time.
+   * @param array $translations
+   *   Array of source/target value translation strings. Only singular strings
+   *   are supported, no plurals. No double quotes are allowed in source and
+   *   translations strings.
+   */
+  private function makePoFile($path, $filename, $timestamp = NULL, $translations = array()) {
+    $timestamp = $timestamp ? $timestamp : REQUEST_TIME;
+    $path = 'public://' . $path;
+    $text = '';
+    $po_header = <<<EOF
+msgid ""
+msgstr ""
+"Project-Id-Version: Drupal 8\\n"
+"MIME-Version: 1.0\\n"
+"Content-Type: text/plain; charset=UTF-8\\n"
+"Content-Transfer-Encoding: 8bit\\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\\n"
+
+EOF;
+
+    // Convert array of translations to Gettext source and translation strings.
+    if ($translations) {
+      foreach ($translations as $source => $target) {
+        $text .= 'msgid "'. $source . '"' . "\n";
+        $text .= 'msgstr "'. $target . '"' . "\n";
+      }
+    }
+
+    file_prepare_directory($path, FILE_CREATE_DIRECTORY);
+    $file = entity_create('file', array(
+      'uid' => 1,
+      'filename' => $filename,
+      'uri' => $path . '/' . $filename,
+      'filemime' => 'text/x-gettext-translation',
+      'timestamp' => $timestamp,
+      'status' => FILE_STATUS_PERMANENT,
+    ));
+    file_put_contents($file->getFileUri(), $po_header . $text);
+    touch(drupal_realpath($file->getFileUri()), $timestamp);
+    $file->save();
+  }
+
+  /**
+   * Setup the environment containting local and remote translation files.
+   *
+   * Update tests require a simulated environment for local and remote files.
+   * Normally remote files are located at a remote server (e.g. ftp.drupal.org).
+   * For testing we can not rely on this. A directory in the file system of the
+   * test site is designated for remote files and is addressed using an absolute
+   * URL. Because Drupal does not allow files with a po extension to be accessed
+   * (denied in .htaccess) the translation files get a _po extension. Another
+   * directory is designated for local translation files.
+   *
+   * The environment is set up with the following files. File creation times are
+   * set to create different variations in test conditions.
+   *   contrib_module_one
+   *    - remote file: timestamp new
+   *    - local file:  timestamp old
+   *   contrib_module_two
+   *    - remote file: timestamp old
+   *    - local file:  timestamp new
+   *   contrib_module_three
+   *    - remote file: timestamp old
+   *    - local file:  timestamp old
+   *   custom_module_one
+   *    - local file:  timestamp new
+   * Time stamp of current translation set by setCurrentTranslations() is always
+   * timestamp medium. This makes it easy to predict which translation will be
+   * imported.
+   */
+  private function setTranslationFiles() {
+    $config = config('locale.settings');
+
+    // A flag is set to let the locale_test module replace the project data with
+    // a set of test projects which match the below project files.
+    \Drupal::state()->set('locale.test_projects_alter', TRUE);
+
+    // Setup the environment.
+    $public_path = variable_get('file_public_path', conf_path() . '/files');
+    $this->setTranslationsDirectory($public_path . '/local');
+    $config->set('translation.default_filename', '%project-%version.%language._po')->save();
+
+    // Setting up sets of translations for the translation files.
+    $translations_one = array('January' => 'Januar_1', 'February' => 'Februar_1', 'March' => 'Marz_1');
+    $translations_two = array( 'February' => 'Februar_2', 'March' => 'Marz_2', 'April' => 'April_2');
+    $translations_three = array('April' => 'April_3', 'May' => 'Mai_3', 'June' => 'Juni_3');
+
+    // Add a number of files to the local file system to serve as remote
+    // translation server and match the project definitions set in
+    // locale_test_locale_translation_projects_alter().
+    $this->makePoFile('remote/8.x/contrib_module_one', 'contrib_module_one-8.x-1.1.de._po', $this->timestamp_new, $translations_one);
+    $this->makePoFile('remote/8.x/contrib_module_two', 'contrib_module_two-8.x-2.0-beta4.de._po', $this->timestamp_old, $translations_two);
+    $this->makePoFile('remote/8.x/contrib_module_three', 'contrib_module_three-8.x-1.0.de._po', $this->timestamp_old, $translations_three);
+
+    // Add a number of files to the local file system to serve as local
+    // translation files and match the project definitions set in
+    // locale_test_locale_translation_projects_alter().
+    $this->makePoFile('local', 'contrib_module_one-8.x-1.1.de._po', $this->timestamp_old, $translations_one);
+    $this->makePoFile('local', 'contrib_module_two-8.x-2.0-beta4.de._po', $this->timestamp_new, $translations_two);
+    $this->makePoFile('local', 'contrib_module_three-8.x-1.0.de._po', $this->timestamp_old, $translations_three);
+    $this->makePoFile('local', 'custom_module_one.de.po', $this->timestamp_new);
+  }
+
+  /**
+   * Setup existing translations in the database and set up the status of
+   * existing translations.
+   */
+  private function setCurrentTranslations() {
+    // Add non customized translations to the database.
+    $langcode = 'de';
+    $context = '';
+    $non_customized_translations = array(
+      'March' => 'Marz',
+      'June' => 'Juni',
+    );
+    foreach ($non_customized_translations as $source => $translation) {
+      $string = $this->container->get('locale.storage')->createString(array(
+          'source' => $source,
+          'context' => $context,
+        ))
+        ->save();
+      $target = $this->container->get('locale.storage')->createTranslation(array(
+        'lid' => $string->getId(),
+        'language' => $langcode,
+        'translation' => $translation,
+        'customized' => LOCALE_NOT_CUSTOMIZED,
+      ))->save();
+    }
+
+    // Add customized translations to the database.
+    $customized_translations = array(
+      'January' => 'Januar_customized',
+      'February' => 'Februar_customized',
+      'May' => 'Mai_customized',
+    );
+    foreach ($customized_translations as $source => $translation) {
+      $string = $this->container->get('locale.storage')->createString(array(
+        'source' => $source,
+        'context' => $context,
+      ))
+      ->save();
+      $target = $this->container->get('locale.storage')->createTranslation(array(
+        'lid' => $string->getId(),
+        'language' => $langcode,
+        'translation' => $translation,
+        'customized' => LOCALE_CUSTOMIZED,
+      ))->save();
+    }
+
+    // Add a state of current translations in locale_files.
+    $default = array(
+      'langcode' => $langcode,
+      'uri' => '',
+      'timestamp' => $this->timestamp_medium,
+      'last_checked' => $this->timestamp_medium,
+    );
+    $data[] = array(
+      'project' => 'contrib_module_one',
+      'filename' => 'contrib_module_one-8.x-1.1.de._po',
+      'version' => '8.x-1.1',
+    );
+    $data[] = array(
+      'project' => 'contrib_module_two',
+      'filename' => 'contrib_module_two-8.x-2.0-beta4.de._po',
+      'version' => '8.x-2.0-beta4',
+    );
+    $data[] = array(
+      'project' => 'contrib_module_three',
+      'filename' => 'contrib_module_three-8.x-1.0.de._po',
+      'version' => '8.x-1.0',
+    );
+    $data[] = array(
+      'project' => 'custom_module_one',
+      'filename' => 'custom_module_one.de.po',
+      'version' => '',
+    );
+    foreach ($data as $file) {
+      $file = (object) array_merge($default, $file);
+      drupal_write_record('locale_file', $file);
+    }
+  }
+
+  /**
+   * Checks the translation of a string.
+   *
+   * @param string $source
+   *   Translation source string
+   * @param string $translation
+   *   Translation to check. Use empty string to check for a not existing
+   *   translation.
+   * @param string $langcode
+   *   Language code of the language to translate to.
+   * @param string $message
+   *   (optional) A message to display with the assertion.
+   */
+  function assertTranslation($source, $translation, $langcode, $message = '') {
+    $db_translation = db_query('SELECT translation FROM {locales_target} lt INNER JOIN {locales_source} ls ON ls.lid = lt.lid WHERE ls.source = :source AND lt.language = :langcode', array(':source' => $source, ':langcode' => $langcode))->fetchField();
+    $db_translation = $db_translation == FALSE ? '' : $db_translation;
+    $this->assertEqual($translation, $db_translation, $message ? $message : format_string('Correct translation of %source (%language)', array('%source' => $source, '%language' => $langcode)));
+
   }
 
   /**
@@ -443,8 +689,8 @@ function testEnableCustomLanguage() {
 
     // Ensure the translation file is automatically imported when the language
     // was added.
-    $this->assertText(t('One translation file imported.'), t('Language file automatically imported.'));
-    $this->assertText(t('One translation string was skipped because of disallowed or malformed HTML'), t('Language file automatically imported.'));
+    $this->assertText(t('One translation file imported.'), 'Language file automatically imported.');
+    $this->assertText(t('One translation string was skipped because of disallowed or malformed HTML'), 'Language file automatically imported.');
 
     // Ensure the strings were successfully imported.
     $search = array(
@@ -453,7 +699,7 @@ function testEnableCustomLanguage() {
       'translation' => 'translated',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertNoText(t('No strings available.'), t('String successfully imported.'));
+    $this->assertNoText(t('No strings available.'), 'String successfully imported.');
 
     // Ensure the multiline string was imported.
     $search = array(
@@ -462,7 +708,7 @@ function testEnableCustomLanguage() {
       'translation' => 'all',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertText('Multiline translation string to make sure that import works with it.', t('String successfully imported.'));
+    $this->assertText('Multiline translation string to make sure that import works with it.', 'String successfully imported.');
 
     // Ensure 'Allowed HTML source string' was imported but the translation for
     // 'Another allowed HTML source string' was not because it contains invalid
@@ -473,8 +719,8 @@ function testEnableCustomLanguage() {
       'translation' => 'all',
     );
     $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
-    $this->assertText('Allowed HTML source string', t('String successfully imported.'));
-    $this->assertNoText('Another allowed HTML source string', t('String with disallowed translation not imported.'));
+    $this->assertText('Allowed HTML source string', 'String successfully imported.');
+    $this->assertNoText('Another allowed HTML source string', 'String with disallowed translation not imported.');
   }
 
 }
