diff --git a/core/modules/system/src/Controller/SystemInfoController.php b/core/modules/system/src/Controller/SystemInfoController.php index cdf0195583..1cb14f0b2c 100644 --- a/core/modules/system/src/Controller/SystemInfoController.php +++ b/core/modules/system/src/Controller/SystemInfoController.php @@ -2,6 +2,7 @@ namespace Drupal\system\Controller; +use Drupal\Core\StringTranslation\StringTranslationTrait; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Response; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; @@ -12,6 +13,8 @@ */ class SystemInfoController implements ContainerInjectionInterface { + use StringTranslationTrait; + /** * System Manager Service. * diff --git a/core/modules/system/src/Element/StatusReportPage.php b/core/modules/system/src/Element/StatusReportPage.php index 6c7f783fd0..e779b255d2 100644 --- a/core/modules/system/src/Element/StatusReportPage.php +++ b/core/modules/system/src/Element/StatusReportPage.php @@ -5,6 +5,7 @@ use Drupal\Core\Render\Element\RenderElement; use Drupal\Core\Render\Element\StatusReport; use Drupal\Core\StringTranslation\PluralTranslatableMarkup; +use Drupal\Core\StringTranslation\TranslatableMarkup; /** * Creates status report page element. @@ -76,18 +77,18 @@ public static function preRenderCounters($element) { $counters = [ 'error' => [ 'amount' => 0, - 'text' => t('Error'), - 'text_plural' => t('Errors'), + 'text' => new TranslatableMarkup('Error'), + 'text_plural' => new TranslatableMarkup('Errors'), ], 'warning' => [ 'amount' => 0, - 'text' => t('Warning'), - 'text_plural' => t('Warnings'), + 'text' => new TranslatableMarkup('Warning'), + 'text_plural' => new TranslatableMarkup('Warnings'), ], 'checked' => [ 'amount' => 0, - 'text' => t('Checked', [], ['context' => 'Examined']), - 'text_plural' => t('Checked', [], ['context' => 'Examined']), + 'text' => new TranslatableMarkup('Checked', [], ['context' => 'Examined']), + 'text_plural' => new TranslatableMarkup('Checked', [], ['context' => 'Examined']), ], ]; diff --git a/core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php b/core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php index a65716b718..65097463c9 100644 --- a/core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php +++ b/core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php @@ -5,6 +5,7 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Form\ConfirmFormBase; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\Url; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -234,8 +235,11 @@ public static function deleteContentEntities($entity_type_id, &$context) { // estimation of the completion level we reached. if (count($entity_ids) > 0 && $context['sandbox']['progress'] != $context['sandbox']['max']) { $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; - $context['message'] = t('Deleting items... Completed @percentage% (@current of @total).', ['@percentage' => round(100 * $context['sandbox']['progress'] / $context['sandbox']['max']), '@current' => $context['sandbox']['progress'], '@total' => $context['sandbox']['max']]); - + $context['message'] = new TranslatableMarkup('Deleting items... Completed @percentage% (@current of @total).', [ + '@percentage' => round(100 * $context['sandbox']['progress'] / $context['sandbox']['max']), + '@current' => $context['sandbox']['progress'], + '@total' => $context['sandbox']['max'], + ]); } else { $context['finished'] = 1; @@ -250,7 +254,7 @@ public static function deleteContentEntities($entity_type_id, &$context) { */ public static function moduleBatchFinished($success, $results, $operations) { $entity_type_plural = \Drupal::entityTypeManager()->getDefinition($results['entity_type_id'])->getPluralLabel(); - \Drupal::messenger()->addStatus(t('All @entity_type_plural have been deleted.', ['@entity_type_plural' => $entity_type_plural])); + \Drupal::messenger()->addStatus(new TranslatableMarkup('All @entity_type_plural have been deleted.', ['@entity_type_plural' => $entity_type_plural])); return new RedirectResponse(Url::fromRoute('system.modules_uninstall')->setAbsolute()->toString()); } diff --git a/core/modules/system/src/Form/RegionalForm.php b/core/modules/system/src/Form/RegionalForm.php index ebbbab6e43..16a24147d4 100644 --- a/core/modules/system/src/Form/RegionalForm.php +++ b/core/modules/system/src/Form/RegionalForm.php @@ -88,7 +88,15 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'select', '#title' => $this->t('First day of week'), '#default_value' => $system_date->get('first_day'), - '#options' => [0 => $this->t('Sunday'), 1 => $this->t('Monday'), 2 => $this->t('Tuesday'), 3 => $this->t('Wednesday'), 4 => $this->t('Thursday'), 5 => $this->t('Friday'), 6 => $this->t('Saturday')], + '#options' => [ + 0 => $this->t('Sunday'), + 1 => $this->t('Monday'), + 2 => $this->t('Tuesday'), + 3 => $this->t('Wednesday'), + 4 => $this->t('Thursday'), + 5 => $this->t('Friday'), + 6 => $this->t('Saturday'), + ], ]; $form['timezone'] = [ diff --git a/core/modules/system/src/Form/SiteMaintenanceModeForm.php b/core/modules/system/src/Form/SiteMaintenanceModeForm.php index 54dc4fb64f..eaf56a5c61 100644 --- a/core/modules/system/src/Form/SiteMaintenanceModeForm.php +++ b/core/modules/system/src/Form/SiteMaintenanceModeForm.php @@ -83,7 +83,11 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'checkbox', '#title' => $this->t('Put site into maintenance mode'), '#default_value' => $this->state->get('system.maintenance_mode'), - '#description' => $this->t('Visitors will only see the maintenance mode message. Only users with the "@permission-label" permission will be able to access the site. Authorized users can log in directly via the user login page.', ['@permission-label' => $permission_label, ':permissions-url' => Url::fromRoute('user.admin_permissions')->toString(), ':user-login' => Url::fromRoute('user.login')->toString()]), + '#description' => $this->t('Visitors will only see the maintenance mode message. Only users with the "@permission-label" permission will be able to access the site. Authorized users can log in directly via the user login page.', [ + '@permission-label' => $permission_label, + ':permissions-url' => Url::fromRoute('user.admin_permissions')->toString(), + ':user-login' => Url::fromRoute('user.login')->toString(), + ]), ]; $form['maintenance_mode_message'] = [ '#type' => 'textarea', diff --git a/core/modules/system/src/Form/SystemBrandingOffCanvasForm.php b/core/modules/system/src/Form/SystemBrandingOffCanvasForm.php index d0dea9b111..6cf135c272 100644 --- a/core/modules/system/src/Form/SystemBrandingOffCanvasForm.php +++ b/core/modules/system/src/Form/SystemBrandingOffCanvasForm.php @@ -8,6 +8,7 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\PluginFormBase; use Drupal\Core\Session\AccountInterface; +use Drupal\Core\StringTranslation\StringTranslationTrait; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -17,6 +18,8 @@ */ class SystemBrandingOffCanvasForm extends PluginFormBase implements ContainerInjectionInterface { + use StringTranslationTrait; + /** * The block plugin. *