diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index ff62f30..8fad9b1 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -2979,7 +2979,7 @@ function language_default() { */ function _language_resolved_path($new_path = NULL) { $path = &drupal_static(__FUNCTION__, NULL); - if ($new_path == NULL) { + if ($new_path === NULL) { return $path; } $path = $new_path; diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php index c58fd5d..aecb0cc 100644 --- a/core/lib/Drupal/Core/CoreBundle.php +++ b/core/lib/Drupal/Core/CoreBundle.php @@ -141,8 +141,7 @@ public function build(ContainerBuilder $container) { ->addArgument(new Reference('controller_resolver')); // Register the 'language_manager' service. - $container->register('language_manager', 'Drupal\Core\Language\LanguageManager') - ->addArgument(new Reference('config.factory')); + $container->register('language_manager', 'Drupal\Core\Language\LanguageManager'); $container->register('database.slave', 'Drupal\Core\Database\Connection') ->setFactoryClass('Drupal\Core\Database\Database') diff --git a/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php index 536d7ca..698057b 100644 --- a/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php @@ -82,7 +82,8 @@ public function onKernelRequestFrontPageResolve(GetResponseEvent $event) { */ public function onKernelRequestLanguageResolve(GetResponseEvent $event) { $request = $event->getRequest(); - if ($path = _language_resolved_path()) { + $path = _language_resolved_path(); + if ($path !== NULL) { $this->setPath($request, $path); } } diff --git a/core/lib/Drupal/Core/Language/LanguageManager.php b/core/lib/Drupal/Core/Language/LanguageManager.php index 8bb3d1e..5ee33d9 100644 --- a/core/lib/Drupal/Core/Language/LanguageManager.php +++ b/core/lib/Drupal/Core/Language/LanguageManager.php @@ -23,13 +23,6 @@ class LanguageManager { protected $request; /** - * A config factory for retrieving required config settings. - * - * @var \Drupal\Core\Config\ConfigFactory - */ - protected $config; - - /** * An array of language objects keyed by language type. * * @var array @@ -52,13 +45,6 @@ class LanguageManager { protected $initializing = FALSE; /** - * Constructs a LanguageManager object. - */ - public function __construct(ConfigFactory $config = NULL) { - $this->config = $config; - } - - /** * Initializes each language type to a language object. */ public function init() { @@ -69,8 +55,6 @@ public function init() { foreach ($this->getLanguageTypes() as $type) { $this->getLanguage($type); } - // @todo D8: Remove after http://drupal.org/node/1859110. - $this->config->reset(); } $this->initialized = TRUE; } diff --git a/core/modules/config/lib/Drupal/config/Tests/LocaleConfigOverride.php b/core/modules/config/lib/Drupal/config/Tests/LocaleConfigOverride.php index 350a166..20f835d 100644 --- a/core/modules/config/lib/Drupal/config/Tests/LocaleConfigOverride.php +++ b/core/modules/config/lib/Drupal/config/Tests/LocaleConfigOverride.php @@ -33,10 +33,6 @@ function testLocaleConfigOverride() { $name = 'config_test.system'; // Verify the default configuration values exist. $config = config($name); - $this->assertIdentical($config->get('foo'), 'bar'); - // Spoof multilingual. - $GLOBALS['conf']['language_count'] = 2; - drupal_language_initialize(); $this->assertIdentical($config->get('foo'), 'en bar'); } } diff --git a/core/modules/language/language.negotiation.inc b/core/modules/language/language.negotiation.inc index a263b60..c654d84 100644 --- a/core/modules/language/language.negotiation.inc +++ b/core/modules/language/language.negotiation.inc @@ -209,11 +209,12 @@ function language_from_user($languages) { * @return * A valid language code on success, FALSE otherwise. */ -function language_from_user_admin($languages) { +function language_from_user_admin($languages, $request = NULL) { // User preference (only for authenticated users). global $user; - if ($user->uid && !empty($user->preferred_admin_langcode) && isset($languages[$user->preferred_admin_langcode]) && path_is_admin(current_path())) { + $request_path = $request ? urldecode(trim($request->getPathInfo(), '/')) : _current_path(); + if ($user->uid && !empty($user->preferred_admin_langcode) && isset($languages[$user->preferred_admin_langcode]) && path_is_admin($request_path)) { return $user->preferred_admin_langcode; } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php index fee58c6..465a4b9 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php @@ -101,13 +101,11 @@ function testUninstallProcess() { // Uninstall Locale. module_disable($locale_module); module_uninstall($locale_module); + $this->rebuildContainer(); // Visit the front page. $this->drupalGet(''); - // Reset the language manager. - $this->container->get('language_manager')->reset(); // Check the init language logic. - drupal_language_initialize(); $this->assertEqual(language(LANGUAGE_TYPE_INTERFACE)->langcode, 'en', t('Language after uninstall: %lang', array('%lang' => language(LANGUAGE_TYPE_INTERFACE)->langcode))); // Check JavaScript files deletion.