diff --git a/core/lib/Drupal/Core/StringTranslation/TranslationInterface.php b/core/lib/Drupal/Core/StringTranslation/TranslationInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..3a6474afb8d6a4cd726705f3a675cac129335502 --- /dev/null +++ b/core/lib/Drupal/Core/StringTranslation/TranslationInterface.php @@ -0,0 +1,34 @@ +<?php + +/** + * @file + * Contains \Drupal\Core\StringTranslation\TranslationInterface. + */ + +namespace Drupal\Core\StringTranslation; + +interface TranslationInterface { + + /** + * Translates a string to the current language or to a given language. + * + * @param string $string + * A string containing the English string to translate. + * @param array $args + * An associative array of replacements to make after translation. Based + * on the first character of the key, the value is escaped and/or themed. + * See \Drupal\Core\Utility\String::format() for details. + * @param array $options + * An associative array of additional options, with the following elements: + * - 'langcode': The language code to translate to a language other than + * what is used to display the page. + * - 'context': The context the source string belongs to. + * + * @return string + * The translated string. + * + * @see \Drupal\Core\Utility\String::format() + */ + public function translate($string, array $args = array(), array $options = array()); + +} diff --git a/core/lib/Drupal/Core/StringTranslation/TranslationManager.php b/core/lib/Drupal/Core/StringTranslation/TranslationManager.php index 130ee9d9fdf9b2c599f971dc54ed99e3fad014ac..8fa2fc7f7d13e7b3164349ac28dbb59f61494266 100644 --- a/core/lib/Drupal/Core/StringTranslation/TranslationManager.php +++ b/core/lib/Drupal/Core/StringTranslation/TranslationManager.php @@ -13,7 +13,7 @@ /** * Defines a chained translation implementation combining multiple translators. */ -class TranslationManager implements TranslatorInterface { +class TranslationManager implements TranslationInterface, TranslatorInterface { /** * An array of active translators keyed by priority. @@ -105,25 +105,7 @@ public function getStringTranslation($langcode, $string, $context) { } /** - * Translates a string to the current language or to a given language. - * - * @param string $string - * A string containing the English string to translate. - * @param array $args - * An associative array of replacements to make after translation. Based - * on the first character of the key, the value is escaped and/or themed. - * See \Drupal\Core\Utility\String::format() for details. - * @param array $options - * An associative array of additional options, with the following elements: - * - 'langcode': The language code to translate to a language other than - * what is used to display the page. - * - 'context': The context the source string belongs to. - * - * @return string - * The translated string. - * - * @see t() - * @see \Drupal\Core\Utility\String::format() + * {@inheritdoc} */ public function translate($string, array $args = array(), array $options = array()) { // Merge in defaults.