diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 3ab64bf..f3b13ac 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -409,6 +409,9 @@ function _drupal_set_preferred_header_name($name = NULL) { * translate to a language other than what is used to display the page. * - 'context' (defaults to the empty context): The context the source string * belongs to. + * @param $no_op + * Return the string directly. This is for cases where the translation string + * needs to be marked but not immediately translated. * * @return * The translated string. @@ -416,7 +419,10 @@ function _drupal_set_preferred_header_name($name = NULL) { * @see \Drupal\Component\Utility\SafeMarkup::format() * @ingroup sanitization */ -function t($string, array $args = array(), array $options = array()) { +function t($string, array $args = array(), array $options = array(), $no_op = FALSE) { + if ($no_op) { + return $string; + } return \Drupal::translation()->translate($string, $args, $options); } diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigDependencyDeleteFormTrait.php b/core/lib/Drupal/Core/Config/Entity/ConfigDependencyDeleteFormTrait.php index ada9ac3..912714a 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigDependencyDeleteFormTrait.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigDependencyDeleteFormTrait.php @@ -23,7 +23,7 @@ * * Provided by \Drupal\Core\StringTranslation\StringTranslationTrait. */ - abstract protected function t($string, array $args = array(), array $options = array()); + abstract protected function t($string, array $args = array(), array $options = array(), $no_op = FALSE); /** * Adds form elements to list affected configuration entities. diff --git a/core/lib/Drupal/Core/Plugin/ContextAwarePluginAssignmentTrait.php b/core/lib/Drupal/Core/Plugin/ContextAwarePluginAssignmentTrait.php index 19d756c..720c406 100644 --- a/core/lib/Drupal/Core/Plugin/ContextAwarePluginAssignmentTrait.php +++ b/core/lib/Drupal/Core/Plugin/ContextAwarePluginAssignmentTrait.php @@ -17,7 +17,7 @@ * * @see \Drupal\Core\StringTranslation\StringTranslationTrait */ - abstract protected function t($string, array $args = array(), array $options = array()); + abstract protected function t($string, array $args = array(), array $options = array(), $no_op = FALSE); /** * Wraps the context handler. diff --git a/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php b/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php index 1d7592b..1177ee3 100644 --- a/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php +++ b/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php @@ -38,7 +38,10 @@ * * See the t() documentation for details. */ - protected function t($string, array $args = array(), array $options = array()) { + protected function t($string, array $args = array(), array $options = array(), $no_op = FALSE) { + if ($no_op) { + return $string; + } return $this->getStringTranslation()->translate($string, $args, $options); }