From ed3bc9bf97b535208adf2b0a106eea9d5be80e36 Mon Sep 17 00:00:00 2001
From: xjm <xjm@65776.no-reply.drupal.org>
Date: Sat, 12 Sep 2015 16:45:02 -0500
Subject: [PATCH] =?UTF-8?q?Issue=20#2565981=20by=20joelpittet,=20alexpott,?=
 =?UTF-8?q?=20G=C3=A1bor=20Hojtsy,=20tstoeckler:=20Remove=20$this->t()=20a?=
 =?UTF-8?q?nd=20SafeMarkup::format()=20in=20SelectLanguageForm?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Core/Installer/Form/SelectLanguageForm.php | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php b/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php
index 91ed3f0fb131..0342d468fa1b 100644
--- a/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php
+++ b/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php
@@ -7,7 +7,6 @@
 
 namespace Drupal\Core\Installer\Form;
 
-use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Component\Utility\UserAgent;
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
@@ -16,6 +15,9 @@
 
 /**
  * Provides the language selection form.
+ *
+ * Note that hardcoded text provided by this form is not translated. This is
+ * because translations are downloaded as a result of submitting this form.
  */
 class SelectLanguageForm extends FormBase {
 
@@ -40,7 +42,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $install_
     $select_options = array();
     $browser_options = array();
 
-    $form['#title'] = $this->t('Choose language');
+    $form['#title'] = 'Choose language';
 
     // Build a select list with language names in native language for the user
     // to choose from. And build a list of available languages for the browser
@@ -62,18 +64,18 @@ public function buildForm(array $form, FormStateInterface $form_state, $install_
     $browser_langcode = UserAgent::getBestMatchingLangcode($request->server->get('HTTP_ACCEPT_LANGUAGE'), $browser_options);
     $form['langcode'] = array(
       '#type' => 'select',
-      '#title' => $this->t('Choose language'),
+      '#title' => 'Choose language',
       '#title_display' => 'invisible',
       '#options' => $select_options,
       // Use the browser detected language as default or English if nothing found.
       '#default_value' => !empty($browser_langcode) ? $browser_langcode : 'en',
     );
+    $link_to_english = install_full_redirect_url(array('parameters' => array('langcode' => 'en')));
     $form['help'] = array(
       '#type' => 'item',
-      '#markup' => SafeMarkup::format('<p>Translations will be downloaded from the <a href="http://localize.drupal.org">Drupal Translation website</a>.
-      If you do not want this, select <a href="!english">English</a>.</p>', array(
-          '!english' => install_full_redirect_url(array('parameters' => array('langcode' => 'en'))),
-        )),
+      // #markup is XSS admin filtered which ensures unsafe protocols will be
+      // removed from the url.
+      '#markup' => '<p>Translations will be downloaded from the <a href="http://localize.drupal.org">Drupal Translation website</a>. If you do not want this, select <a href="' . $link_to_english . '">English</a>.</p>',
       '#states' => array(
         'invisible' => array(
           'select[name="langcode"]' => array('value' => 'en'),
@@ -83,7 +85,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $install_
     $form['actions'] = array('#type' => 'actions');
     $form['actions']['submit'] =  array(
       '#type' => 'submit',
-      '#value' => $this->t('Save and continue'),
+      '#value' => 'Save and continue',
       '#button_type' => 'primary',
     );
     return $form;
-- 
GitLab