Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
3e839344
Commit
3e839344
authored
Aug 21, 2013
by
alexpott
Browse files
Issue
#2049709
by plopesc: TranslationManager::translate() should be on an interface.
parent
265940c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/StringTranslation/TranslationInterface.php
0 → 100644
View file @
3e839344
<?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
());
}
core/lib/Drupal/Core/StringTranslation/TranslationManager.php
View file @
3e839344
...
...
@@ -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.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment