diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php
index a1d4da4..04526bb 100644
--- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php
+++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php
@@ -192,6 +192,8 @@ public function processOutbound($path, &$options = array(), Request $request = N
    */
   public function getLanguageSwitchLinks(Request $request, $type, Url $url) {
     $links = array();
+    $query = array();
+    parse_str($request->getQueryString(), $query);
 
     foreach ($this->languageManager->getNativeLanguages() as $language) {
       $links[$language->getId()] = array(
@@ -202,6 +204,7 @@ public function getLanguageSwitchLinks(Request $request, $type, Url $url) {
         'title' => $language->getName(),
         'language' => $language,
         'attributes' => array('class' => array('language-link')),
+        'query' => $query,
       );
     }
 
diff --git a/core/modules/language/src/Tests/LanguageSwitchingTest.php b/core/modules/language/src/Tests/LanguageSwitchingTest.php
index c076e6f..eabdca3 100644
--- a/core/modules/language/src/Tests/LanguageSwitchingTest.php
+++ b/core/modules/language/src/Tests/LanguageSwitchingTest.php
@@ -118,8 +118,10 @@ protected function doTestLanguageBlockAuthenticated($block_label) {
   protected function doTestLanguageBlockAnonymous($block_label) {
     $this->drupalLogout();
 
+    // Added one dummy query string for testing purpose.
+    $options =  array('query' => array('foo' => 'bar'));
     // Assert that the language switching block is displayed on the frontpage.
-    $this->drupalGet('');
+    $this->drupalGet('',$options);
     $this->assertText($block_label, 'Language switcher block found.');
 
     // Assert that only the current language is marked as active.
