diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php
index b53ba51..db43ff1 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php
@@ -125,7 +125,7 @@ function testContentTypeLanguageConfiguration() {
// Edit the content and ensure correct language is selected.
$path = 'node/' . $node->nid . '/edit';
$this->drupalGet($path);
- $this->assertRaw('', t('Correct language selected.'));
+ $this->assertRaw('', '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. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log 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..ca8be7a 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleJavascriptTranslation.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleJavascriptTranslation.php
@@ -96,12 +96,11 @@ 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]), String::format("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));
- }
+ $this->assertTrue(isset($source_strings[$str]) && $source_strings[$str] === $context, strlen($context) > 0 ? String::format("Context for %source is %context", $args) : String::format("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('');
$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 0ef62a9..a03f1df 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php
@@ -155,9 +155,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.');
@@ -166,11 +166,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');
@@ -256,15 +256,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..2b7ae59 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), String::format('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), String::format('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), String::format('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 961a5dd..858d43a 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php
@@ -68,7 +68,7 @@ function testUninstallProcess() {
global $user;
$user = drupal_anonymous_user();
- $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)->id, $this->langcode, String::format('Current language: %lang', array('%lang' => language(Language::TYPE_INTERFACE)->id)));
// Enable multilingual workflow option for articles.
language_save_default_configuration('node', 'article', array('langcode' => 'site_default', 'language_show' => TRUE));
@@ -89,7 +89,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), String::format('JavaScript file created: %file', array('%file' => $js_file)));
// Disable string caching.
$config->set('cache_strings', 0)->save();
@@ -115,31 +115,31 @@ function testUninstallProcess() {
// Visit the front page.
$this->drupalGet('');
// Check the init language logic.
- $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)->id, 'en', String::format('Language after uninstall: %lang', array('%lang' => language(Language::TYPE_INTERFACE)->id)));
// Check JavaScript files deletion.
- $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), String::format('JavaScript file deleted: %file', array('%file' => $result ? $js_file : 'found')));
// 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, String::format('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, String::format('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, String::format('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, String::format('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, String::format('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..cb19716 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUpdateTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUpdateTest.php
@@ -443,8 +443,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 +453,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 +462,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 +473,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.');
}
}