diff -u b/core/modules/locale/lib/Drupal/locale/Form/TranslateEditForm.php b/core/modules/locale/lib/Drupal/locale/Form/TranslateEditForm.php
--- b/core/modules/locale/lib/Drupal/locale/Form/TranslateEditForm.php
+++ b/core/modules/locale/lib/Drupal/locale/Form/TranslateEditForm.php
@@ -28,11 +28,11 @@
protected $state;
/**
- * The translator service.
+ * The translationManager service.
*
* @var \Drupal\Core\StringTranslation\Translator\TranslatorInterface
*/
- protected $translator;
+ protected $translationManager;
/**
*
@@ -49,13 +49,13 @@
* The locale storage.
* @param \Symfony\Component\HttpFoundation\Request $request
* The request for this page.
- * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translator
+ * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translationManager
* The translation interface to be appended to the translation chain.
* @param \Drupal\Core\KeyValueStore\KeyValueStoreInterface $state
* The state key/value store.
*/
- public function __construct(StringStorageInterface $locale_storage, Request $request, TranslatorInterface $translator, KeyValueStoreInterface $state) {
- parent::__construct($locale_storage, $request, $translator);
+ public function __construct(StringStorageInterface $locale_storage, Request $request, TranslatorInterface $translationManager, KeyValueStoreInterface $state) {
+ parent::__construct($locale_storage, $request, $translationManager);
$this->state = $state;
}
@@ -135,7 +135,7 @@
);
$form['strings'][$string->lid]['original'] = array(
'#type' => 'item',
- '#title' => $this->translator->translate('Source string (@language)', array('@language' => $this->translator->translate('Built-in English'))),
+ '#title' => $this->translationManager->translate('Source string (@language)', array('@language' => $this->translationManager->translate('Built-in English'))),
'#title_display' => 'invisible',
'#markup' => '' . String::checkPlain($source_array[0]) . '',
);
@@ -148,13 +148,13 @@
);
$form['strings'][$string->lid]['original_singular'] = array(
'#type' => 'item',
- '#title' => $this->translator->translate('Singular form'),
+ '#title' => $this->translationManager->translate('Singular form'),
'#markup' => '' . String::checkPlain($source_array[0]) . '',
- '#prefix' => '' . $this->translator->translate('Source string (@language)', array('@language' => $this->translator->translate('Built-in English'))) . ''
+ '#prefix' => '' . $this->translationManager->translate('Source string (@language)', array('@language' => $this->translationManager->translate('Built-in English'))) . ''
);
$form['strings'][$string->lid]['original_plural'] = array(
'#type' => 'item',
- '#title' => $this->translator->translate('Plural form'),
+ '#title' => $this->translationManager->translate('Plural form'),
'#markup' => '' . String::checkPlain($source_array[1]) . '',
);
}
@@ -169,7 +169,7 @@
if (empty($form['strings'][$string->lid]['plural']['#value'])) {
$form['strings'][$string->lid]['translations'][0] = array(
'#type' => 'textarea',
- '#title' => $this->translator->translate('Translated string (@language)', array('@language' => $langname)),
+ '#title' => $this->translationManager->translate('Translated string (@language)', array('@language' => $langname)),
'#title_display' => 'invisible',
'#rows' => $rows,
'#default_value' => $translation_array[0],
@@ -183,11 +183,11 @@
for ($i = 0; $i < $plural_formulas[$langcode]['plurals']; $i++) {
$form['strings'][$string->lid]['translations'][$i] = array(
'#type' => 'textarea',
- '#title' => ($i == 0 ? $this->translator->translate('Singular form') : format_plural($i, 'First plural form', '@count. plural form')),
+ '#title' => ($i == 0 ? $this->translationManager->translate('Singular form') : format_plural($i, 'First plural form', '@count. plural form')),
'#rows' => $rows,
'#default_value' => isset($translation_array[$i]) ? $translation_array[$i] : '',
'#attributes' => array('lang' => $langcode),
- '#prefix' => $i == 0 ? ('' . $this->translator->translate('Translated string (@language)', array('@language' => $langname)) . '') : '',
+ '#prefix' => $i == 0 ? ('' . $this->translationManager->translate('Translated string (@language)', array('@language' => $langname)) . '') : '',
);
}
}
@@ -195,15 +195,15 @@
// Fallback for unknown number of plurals.
$form['strings'][$string->lid]['translations'][0] = array(
'#type' => 'textarea',
- '#title' => $this->translator->translate('Singular form'),
+ '#title' => $this->translationManager->translate('Singular form'),
'#rows' => $rows,
'#default_value' => $translation_array[0],
'#attributes' => array('lang' => $langcode),
- '#prefix' => '' . $this->translator->translate('Translated string (@language)', array('@language' => $langname)) . '',
+ '#prefix' => '' . $this->translationManager->translate('Translated string (@language)', array('@language' => $langname)) . '',
);
$form['strings'][$string->lid]['translations'][1] = array(
'#type' => 'textarea',
- '#title' => $this->translator->translate('Plural form'),
+ '#title' => $this->translationManager->translate('Plural form'),
'#rows' => $rows,
'#default_value' => isset($translation_array[1]) ? $translation_array[1] : '',
'#attributes' => array('lang' => $langcode),
@@ -215,7 +215,7 @@
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
- '#value' => $this->translator->translate('Save translations'),
+ '#value' => $this->translationManager->translate('Save translations'),
);
}
}
@@ -230,8 +230,8 @@
foreach ($form_state['values']['strings'] as $lid => $translations) {
foreach ($translations['translations'] as $key => $value) {
if (!locale_string_is_safe($value)) {
- form_set_error("strings][$lid][translations][$key", $this->translator->translate('The submitted string contains disallowed HTML: %string', array('%string' => $value)));
- form_set_error("translations][$langcode][$key", $this->translator->translate('The submitted string contains disallowed HTML: %string', array('%string' => $value)));
+ form_set_error("strings][$lid][translations][$key", $this->translationManager->translate('The submitted string contains disallowed HTML: %string', array('%string' => $value)));
+ form_set_error("translations][$langcode][$key", $this->translationManager->translate('The submitted string contains disallowed HTML: %string', array('%string' => $value)));
watchdog('locale', 'Attempted submission of a translation string with disallowed HTML: %string', array('%string' => $value), WATCHDOG_WARNING);
}
}
@@ -290,7 +290,7 @@
}
}
- drupal_set_message($this->translator->translate('The strings have been saved.'));
+ drupal_set_message($this->translationManager->translate('The strings have been saved.'));
// Keep the user on the current pager page.
$page = $this->request->query->get('page');
diff -u b/core/modules/locale/lib/Drupal/locale/Form/TranslateFilterForm.php b/core/modules/locale/lib/Drupal/locale/Form/TranslateFilterForm.php
--- b/core/modules/locale/lib/Drupal/locale/Form/TranslateFilterForm.php
+++ b/core/modules/locale/lib/Drupal/locale/Form/TranslateFilterForm.php
@@ -93,7 +93,7 @@
$op = $form_state['values']['op'];
$filters = $this->translateFilters();
switch ($op) {
- case t('Filter'):
+ case $this->translationManager->translate('Filter'):
foreach ($filters as $name => $filter) {
if (isset($form_state['values'][$name])) {
$_SESSION['locale_translate_filter'][$name] = $form_state['values'][$name];
@@ -101,7 +101,7 @@
}
break;
- case t('Reset'):
+ case $this->translationManager->translate('Reset'):
$_SESSION['locale_translate_filter'] = array();
break;
}
diff -u b/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php b/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php
--- b/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php
+++ b/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php
@@ -9,7 +9,9 @@
use Drupal\Core\Controller\ControllerInterface;
use Drupal\Core\Form\FormInterface;
+use Drupal\Core\StringTranslation\TranslationManager;
use Drupal\Core\Language\Language;
+use Drupal\locale\StringStorageInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
@@ -35,6 +37,13 @@
protected $request;
/**
+ * The translation manager service.
+ *
+ * @var \Drupal\Core\StringTranslation\TranslationManager
+ */
+ protected $translationManager;
+
+ /**
* Filter values. Shared between objects that inherite this class.
*
* @var array | null
@@ -48,13 +57,13 @@
* The locale storage.
* @param \Symfony\Component\HttpFoundation\Request $request
* The request for this page.
- * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translator
- * The translation interface to be appended to the translation chain.
+ * @param \Drupal\Core\StringTranslation\TranslationManager $translation_manager
+ * The translation manager service.
*/
- public function __construct(StringStorageInterface $locale_storage, Request $request, TranslatorInterface $translator) {
+ public function __construct(StringStorageInterface $locale_storage, Request $request, TranslationManager $translation_manager) {
$this->localeStorage = $locale_storage;
$this->request = $request;
- $this->translator = $translator;
+ $this->translationManager = $translation_manager;
}
/**
@@ -181,33 +190,33 @@
}
$filters['string'] = array(
- 'title' => $this->translator->translate('String contains'),
- 'description' => t('Leave blank to show all strings. The search is case sensitive.'),
+ 'title' => $this->translationManager->translate('String contains'),
+ 'description' => $this->translationManager->translate('Leave blank to show all strings. The search is case sensitive.'),
'default' => '',
);
$filters['langcode'] = array(
- 'title' => t('Translation language'),
+ 'title' => $this->translationManager->translate('Translation language'),
'options' => $language_options,
'default' => $default_langcode,
);
$filters['translation'] = array(
- 'title' => t('Search in'),
+ 'title' => $this->translationManager->translate('Search in'),
'options' => array(
- 'all' => t('Both translated and untranslated strings'),
- 'translated' => t('Only translated strings'),
- 'untranslated' => t('Only untranslated strings'),
+ 'all' => $this->translationManager->translate('Both translated and untranslated strings'),
+ 'translated' => $this->translationManager->translate('Only translated strings'),
+ 'untranslated' => $this->translationManager->translate('Only untranslated strings'),
),
'default' => 'all',
);
$filters['customized'] = array(
- 'title' => t('Translation type'),
+ 'title' => $this->translationManager->translate('Translation type'),
'options' => array(
- 'all' => t('All'),
- LOCALE_NOT_CUSTOMIZED => t('Non-customized translation'),
- LOCALE_CUSTOMIZED => t('Customized translation'),
+ 'all' => $this->translationManager->translate('All'),
+ LOCALE_NOT_CUSTOMIZED => $this->translationManager->translate('Non-customized translation'),
+ LOCALE_CUSTOMIZED => $this->translationManager->translate('Customized translation'),
),
'states' => array(
'visible' => array(