diff --git a/core/modules/language/language.install b/core/modules/language/language.install
index 92f61a0..92c61f4 100644
--- a/core/modules/language/language.install
+++ b/core/modules/language/language.install
@@ -15,10 +15,25 @@ function language_install() {
   // Add the default language to the database too.
   language_save(language_default());
 
-  // Enable URL language detection for each configurable language type.
   require_once DRUPAL_ROOT . '/core/includes/language.inc';
-  foreach (language_types_get_configurable(FALSE) as $type) {
-    language_negotiation_set($type, array(LANGUAGE_NEGOTIATION_URL => 0));
+
+  // We cannot rely on language negotiation hooks here, because locale module is
+  // not enabled yet. Therefore language_negotiation_set() cannot be used.
+  $info = language_negotiation_info();
+  $method = $info[LANGUAGE_NEGOTIATION_URL];
+  $method_fields = array('callbacks', 'file', 'cache');
+  $negotiation = array();
+
+  // Store only the needed data.
+  foreach ($method_fields as $field) {
+    if (isset($method[$field])) {
+      $negotiation[LANGUAGE_NEGOTIATION_URL][$field] = $method[$field];
+    }
+  }
+
+  // Enable URL language detection for each (core) configurable language type.
+  foreach (language_types_get_configurable() as $type) {
+    variable_set("language_negotiation_$type", $negotiation);
   }
 }
 
