diff --git a/core/includes/language.inc b/core/includes/language.inc
index 74d5752..36224c1 100644
--- a/core/includes/language.inc
+++ b/core/includes/language.inc
@@ -461,6 +461,9 @@ function language_negotiation_method_invoke($method_id, $method = NULL, $request
     // If the language negotiation method has no cache preference or this is
     // satisfied we can execute the callback.
     $cache = !isset($method['cache']) || $user->uid || $method['cache'] == variable_get('cache', 0);
+    $container = drupal_container();
+    $languageManager = $container->get('language_manager');
+    $plugin = $languageManager->createInstance($method['id'], $container->get('request'), $container->getParameter('language.negotiation'));
     $callback = isset($method['callbacks']['negotiation']) ? $method['callbacks']['negotiation'] : FALSE;
     $langcode = $cache && function_exists($callback) ? $callback($languages, $request) : FALSE;
     $results[$method_id] = isset($languages[$langcode]) ? $languages[$langcode] : FALSE;
diff --git a/core/modules/language/lib/Drupal/language/Plugin/NegotiationBase.php b/core/modules/language/lib/Drupal/language/Plugin/NegotiationBase.php
new file mode 100644
index 0000000..7edb2a1
--- /dev/null
+++ b/core/modules/language/lib/Drupal/language/Plugin/NegotiationBase.php
@@ -0,0 +1,65 @@
+<?php
+
+namespace Drupal\language\Plugin;
+
+use Symfony\Component\HttpFoundation\Request;
+use Drupal\Component\Utility\NestedArray;
+use Drupal\Core\Language\LanguageManager;
+
+abstract class NegotiationBase implements NegotiationInterface {
+  /**
+   * The request object.
+   *
+   * @var \Symfony\Component\HttpFoundation\Request
+   */
+  protected $request;
+
+  /**
+   * The language manager.
+   *
+   * @var \Drupal\Core\Language\LanguageManager
+   */
+  protected $languageManager;
+
+  /**
+   * The contents of the language.negotiation config object.
+   *
+   * @var array
+   */
+  protected $config;
+
+  /**
+   * @param \Symfony\Component\HttpFoundation\Request $request
+   * @param \Drupal\Core\Language\LanguageManager $languageManager
+   * @param array $config
+   */
+  function __construct(Request $request, LanguageManager $languageManager, array $config) {
+    $this->request = $request;
+    $this->config = $config;
+  }
+
+  abstract function negotiation($languages);
+
+  public function languageSwitch() {
+    throw new \Exception('Not implemented');
+  }
+
+  public function urlRewrite() {
+    throw new \Exception('Not implemented');
+  }
+
+  protected function getConfig($key) {
+    $parts = explode('.', $key);
+    if (count($parts) == 1) {
+      return isset($this->config[$key]) ? $this->config[$key] : NULL;
+    }
+    else {
+      $value = NestedArray::getValue($this->config, $parts, $key_exists);
+      return $key_exists ? $value : NULL;
+    }
+  }
+
+  protected function getLanguage($type) {
+    return $this->languageManager->getLanguage($type)->langcode;
+  }
+}
diff --git a/core/modules/language/lib/Drupal/language/Plugin/NegotiationInterface.php b/core/modules/language/lib/Drupal/language/Plugin/NegotiationInterface.php
new file mode 100644
index 0000000..119a294
--- /dev/null
+++ b/core/modules/language/lib/Drupal/language/Plugin/NegotiationInterface.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Drupal\language\Plugin;
+
+interface NegotiationInterface {
+  function negotiation($languages);
+  function languageSwitch();
+  function urlRewrite();
+}
diff --git a/core/modules/language/lib/Drupal/language/Plugin/NegotiationManager.php b/core/modules/language/lib/Drupal/language/Plugin/NegotiationManager.php
new file mode 100644
index 0000000..9524a90
--- /dev/null
+++ b/core/modules/language/lib/Drupal/language/Plugin/NegotiationManager.php
@@ -0,0 +1,23 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\language\Plugin\NegotiationManager.
+ */
+
+namespace Drupal\language\Plugin;
+
+use Drupal\Component\Plugin\PluginManagerBase;
+use Drupal\Component\Plugin\Factory\DefaultFactory;
+use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
+
+/**
+ * Manages language Negotiation plugins.
+ */
+class NegotiationManager extends PluginManagerBase {
+
+  public function __construct() {
+    $this->discovery = new AnnotatedClassDiscovery('language', 'negotiation');
+    $this->factory = new DefaultFactory($this->discovery);
+  }
+}
diff --git a/core/modules/language/lib/Drupal/language/Plugin/NegotiationNotImplementedException.php b/core/modules/language/lib/Drupal/language/Plugin/NegotiationNotImplementedException.php
new file mode 100644
index 0000000..aa3c12a
--- /dev/null
+++ b/core/modules/language/lib/Drupal/language/Plugin/NegotiationNotImplementedException.php
@@ -0,0 +1,10 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\language\Plugin\NegotiationNotImplementedException.
+ */
+
+namespace Drupal\language\Plugin;
+
+class NegotiationNotImplementedException extends \Exception {}
diff --git a/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/Browser.php b/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/Browser.php
new file mode 100644
index 0000000..7aafccd
--- /dev/null
+++ b/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/Browser.php
@@ -0,0 +1,117 @@
+<?php
+
+namespace Drupal\language\Plugin\language\negotiation;
+
+use Drupal\Core\Annotation\Plugin;
+use Drupal\Core\Annotation\Translation;
+use Drupal\language\Plugin\NegotiationBase;
+use Symfony\Component\HttpFoundation\Request;
+
+/**
+ * @Plugin(
+ *   id = "browser",
+ *   weight = -2,
+ *   name = @Translation("Browser"),
+ *   description = @Translation("Language from the browser's language settings."),
+ *   config = "admin/config/regional/language/detection/browser"
+ * )
+ */
+class Browser extends NegotiationBase {
+  function negotation($languages) {
+    if (empty($this->request->server->get('HTTP_ACCEPT_LANGUAGE'))) {
+      return FALSE;
+    }
+
+    // The Accept-Language header contains information about the language
+    // preferences configured in the user's browser / operating system. RFC 2616
+    // (section 14.4) defines the Accept-Language header as follows:
+    //   Accept-Language = "Accept-Language" ":"
+    //                  1#( language-range [ ";" "q" "=" qvalue ] )
+    //   language-range  = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
+    // Samples: "hu, en-us;q=0.66, en;q=0.33", "hu,en-us;q=0.5"
+    $browser_langcodes = array();
+    if (preg_match_all('@(?<=[, ]|^)([a-zA-Z-]+|\*)(?:;q=([0-9.]+))?(?:$|\s*,\s*)@', trim($this->request->server->get('HTTP_ACCEPT_LANGUAGE')), $matches, PREG_SET_ORDER)) {
+      // Load custom mappings to support browsers that are sending non standard
+      // language codes.
+      $mappings = language_get_browser_drupal_langcode_mappings();
+      foreach ($matches as $match) {
+        if ($mappings) {
+          $langcode = strtolower($match[1]);
+          foreach ($mappings as $browser_langcode => $drupal_langcode) {
+            if ($langcode == $browser_langcode) {
+              $match[1] = $drupal_langcode;
+            }
+          }
+        }
+        // We can safely use strtolower() here, tags are ASCII.
+        // RFC2616 mandates that the decimal part is no more than three digits,
+        // so we multiply the qvalue by 1000 to avoid floating point comparisons.
+        $langcode = strtolower($match[1]);
+        $qvalue = isset($match[2]) ? (float) $match[2] : 1;
+        $browser_langcodes[$langcode] = (int) ($qvalue * 1000);
+      }
+    }
+
+    // We should take pristine values from the HTTP headers, but Internet Explorer
+    // from version 7 sends only specific language tags (eg. fr-CA) without the
+    // corresponding generic tag (fr) unless explicitly configured. In that case,
+    // we assume that the lowest value of the specific tags is the value of the
+    // generic language to be as close to the HTTP 1.1 spec as possible.
+    // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4 and
+    // http://blogs.msdn.com/b/ie/archive/2006/10/17/accept-language-header-for-internet-explorer-7.aspx
+    asort($browser_langcodes);
+    foreach ($browser_langcodes as $langcode => $qvalue) {
+      // For Chinese languages the generic tag is either zh-hans or zh-hant, so we
+      // need to handle this separately, we can not split $langcode on the
+      // first occurence of '-' otherwise we get a non-existing language zh.
+      // All other languages use a langcode without a '-', so we can safely split
+      // on the first occurence of it.
+      $generic_tag = '';
+      if (strlen($langcode) > 7 && (substr($langcode, 0, 7) == 'zh-hant' || substr($langcode, 0, 7) == 'zh-hans')) {
+        $generic_tag = substr($langcode, 0, 7);
+      }
+      else {
+        $generic_tag = strtok($langcode, '-');
+      }
+      if (!empty($generic_tag) && !isset($browser_langcodes[$generic_tag])) {
+        // Add the generic langcode, but make sure it has a lower qvalue as the
+        // more specific one, so the more specific one gets selected if it's
+        // defined by both the browser and Drupal.
+        $browser_langcodes[$generic_tag] = $qvalue - 0.1;
+      }
+    }
+
+    // Find the enabled language with the greatest qvalue, following the rules of
+    // RFC 2616 (section 14.4). If several languages have the same qvalue, prefer
+    // the one with the greatest weight.
+    $best_match_langcode = FALSE;
+    $max_qvalue = 0;
+    foreach ($languages as $langcode => $language) {
+      // Language tags are case insensitive (RFC2616, sec 3.10).
+      $langcode = strtolower($langcode);
+
+      // If nothing matches below, the default qvalue is the one of the wildcard
+      // language, if set, or is 0 (which will never match).
+      $qvalue = isset($browser_langcodes['*']) ? $browser_langcodes['*'] : 0;
+
+      // Find the longest possible prefix of the browser-supplied language ('the
+      // language-range') that matches this site language ('the language tag').
+      $prefix = $langcode;
+      do {
+        if (isset($browser_langcodes[$prefix])) {
+          $qvalue = $browser_langcodes[$prefix];
+          break;
+        }
+      }
+      while ($prefix = substr($prefix, 0, strrpos($prefix, '-')));
+
+      // Find the best match.
+      if ($qvalue > $max_qvalue) {
+        $best_match_langcode = $language->langcode;
+        $max_qvalue = $qvalue;
+      }
+    }
+
+    return $best_match_langcode;
+  }
+}
diff --git a/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/Detected.php b/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/Detected.php
new file mode 100644
index 0000000..7f7b272
--- /dev/null
+++ b/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/Detected.php
@@ -0,0 +1,22 @@
+<?php
+
+namespace Drupal\language\Plugin\language\negotiation;
+
+use Drupal\Core\Annotation\Plugin;
+use Drupal\Core\Annotation\Translation;
+use Drupal\language\Plugin\NegotiationBase;
+
+/**
+ * @Plugin(
+ *   id = "interface",
+ *   weight = 9,
+ *   name = @Translation("Interface"),
+ *   description = @Translation("Use the detected interface language."),
+ *   types = {LANGUAGE_TYPE_CONTENT},
+ * )
+ */
+class Detected extends NegotiationBase {
+  function negotiation($languages) {
+    return $this->getLanguage(LANGUAGE_TYPE_INTERFACE);
+  }
+}
diff --git a/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/Session.php b/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/Session.php
new file mode 100644
index 0000000..6978f63
--- /dev/null
+++ b/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/Session.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace Drupal\language\Plugin\language\negotiation;
+
+use Drupal\Core\Annotation\Plugin;
+use Drupal\Core\Annotation\Translation;
+use Drupal\language\Plugin\NegotiationBase;
+
+/**
+ * @Plugin(
+ *   id = "session",
+ *   weight = -6,
+ *   name = @Translation("Session"),
+ *   description = @Translation("Language from a request/session parameter.."),
+ *   config = "admin/config/regional/language/detection/session"
+ * )
+ */
+class User extends NegotiationBase {
+  function negotation($languages) {
+    global $user;
+
+    if ($user->uid && !empty($user->preferred_langcode) && isset($languages[$user->preferred_langcode])) {
+      return $user->preferred_langcode;
+    }
+
+    // No language preference from the user.
+    return FALSE;
+  }
+
+  function langugeSwitch() {
+  }
+
+  function urlRewrite() {
+  }
+}
diff --git a/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/Url.php b/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/Url.php
new file mode 100644
index 0000000..e69de29
diff --git a/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/UrlFallback.php b/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/UrlFallback.php
new file mode 100644
index 0000000..0ed7c08
--- /dev/null
+++ b/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/UrlFallback.php
@@ -0,0 +1,36 @@
+<?php
+
+namespace Drupal\language\Plugin\language\negotiation;
+
+use Drupal\Core\Annotation\Plugin;
+use Drupal\Core\Annotation\Translation;
+use Drupal\language\Plugin\NegotiationBase;
+
+/**
+ * @Plugin(
+ *   id = "interface",
+ *   weight = 8,
+ *   name = @Translation("URL fallback"),
+ *   description = @Translation("Use an already detected language for URLs if none is found.."),
+ * )
+ */
+class UrlFallback extends NegotiationBase {
+  function negotiation($languages) {
+    $default = language_default();
+    $prefix = ($this->getConfig('url.source') == LANGUAGE_NEGOTIATION_URL_PREFIX);
+
+    // If the default language is not configured to convey language information,
+    // a missing URL language information indicates that URL language should be
+    // the default one, otherwise we fall back to an already detected language.
+    $domains = $this->getConfig('url.domains');
+    $prefixes = $this->getConfig('url.prefixes');
+    if (($prefix && empty($prefixes[$default->langcode])) || (!$prefix && empty($domains[$default->langcode]))) {
+      return $default->langcode;
+    }
+    else {
+      // @todo this probably needs to be configurable.
+      $langcode = $this->getLanguage(LANGUAGE_TYPE_INTERFACE);
+      return $langcode;
+    }
+  }
+}
diff --git a/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/User.php b/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/User.php
new file mode 100644
index 0000000..411b1e4
--- /dev/null
+++ b/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/User.php
@@ -0,0 +1,31 @@
+<?php
+
+namespace Drupal\language\Plugin\language\negotiation;
+
+use Drupal\Core\Annotation\Plugin;
+use Drupal\Core\Annotation\Translation;
+use Drupal\language\Plugin\NegotiationBase;
+
+/**
+ * @Plugin(
+ *   id = "url",
+ *   weight = -8,
+ *   name = @Translation("URL"),
+ *   description = @Translation("Language from the URL (Path prefix or domain)."),
+ *   types = {LANGUAGE_TYPE_CONTENT, LANGUAGE_TYPE_INTERFACE, LANGUAGE_TYPE_URL},
+ *   config = "admin/config/regional/language/detection/url"
+ * )
+ */
+class User extends NegotiationBase {
+  function negotation($languages) {
+    global $user;
+
+    if ($user->uid && !empty($user->preferred_langcode) && isset($languages[$user->preferred_langcode])) {
+      return $user->preferred_langcode;
+    }
+
+    // No language preference from the user.
+    return FALSE;
+  }
+
+}
diff --git a/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/UserAdmin.php b/core/modules/language/lib/Drupal/language/Plugin/language/negotiation/UserAdmin.php
new file mode 100644
index 0000000..e69de29
diff --git a/index.php b/index.php
index 98bcddb..d0ed2a5 100644
--- a/index.php
+++ b/index.php
@@ -32,11 +32,12 @@
 
 // @todo Remove this once everything in the bootstrap has been
 //   converted to services in the DIC.
+// Create a request object from the HTTPFoundation.
+$request = Request::createFromGlobals();
 $kernel->boot();
+drupal_container()->enterScope('request');
+drupal_container()->set('request', $request, 'request');
 drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE);
 
-// Create a request object from the HTTPFoundation.
-$request = Request::createFromGlobals();
 $response = $kernel->handle($request)->prepare($request)->send();
-
 $kernel->terminate($request, $response);
