diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 7daf311..773b024 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -7,6 +7,7 @@ use Symfony\Component\ClassLoader\ApcUniversalClassLoader; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Exception\RuntimeException as DependencyInjectionRuntimeException; use Symfony\Component\HttpFoundation\Request; use Drupal\Core\Language\Language; @@ -1457,7 +1458,7 @@ function t($string, array $args = array(), array $options = array()) { // Merge in default. if (empty($options['langcode'])) { - $options['langcode'] = language_manager(LANGUAGE_TYPE_INTERFACE)->langcode; + $options['langcode'] = language(LANGUAGE_TYPE_INTERFACE)->langcode; } if (empty($options['context'])) { $options['context'] = ''; @@ -2604,13 +2605,13 @@ function get_t() { /** * Initializes all the defined language types. * - * @see language_manager() + * @see language() */ function drupal_language_initialize() { if (language_multilingual()) { $types = language_types_get_all(); foreach ($types as $type) { - language_manager($type); + language($type); } // Allow modules to react on language system initialization in multilingual // environments. @@ -2619,56 +2620,61 @@ function drupal_language_initialize() { } /** - * Initializes the passed in language type. + * Returns the language object for a given language type. * * The 'language_manager' service is only available within the scope of a kernel * request. When it's not available, we return a default language object, * regardless of the type passed in. * - * Note that this function is provided for legacy code that needs to get e.g. - * the interface language outside the scope of a request. Code that runs within - * the scope of a request should call - * drupal_container()->get('language_manager')->getLanguage($type) - * directly. - * * @see Drupal\Core\Language\LanguageManager * * @param $type - * The type of language object needed, e.g. LANGUAGE_TYPE_INTERFACE. Passing - * NULL invokes a reset of the statically stored language type objects. - */ -function language_manager($type = NULL) { - // Keep track of whether we are in a multilingual environment. - static $multilingual = FALSE; - // Keep track of whether the language_manager service is available. - static $language_manager_service = FALSE; - if ($multilingual && $language_manager_service) { - if (!$type) { - drupal_container()->get('language_manager')->reset(); - return; - } - return drupal_container()->get('language_manager')->getLanguage($type); - } - if (language_multilingual()) { - $multilingual = TRUE; + * The type of language object needed, e.g. LANGUAGE_TYPE_INTERFACE. + * @param $reset + * TRUE to reset the statically cached language object for the type, or for + * all types if $type is NULL. + */ +function language($type, $reset = FALSE) { + // We don't use drupal_static() here because resetting is not a simple case of + // drupal_static_reset(). + static $languages = array(); + + // Reset the language manager's cache and our own. + if ($reset) { if (drupal_container()->has('language_manager')) { - $language_manager_service = TRUE; - return drupal_container()->get('language_manager')->getLanguage($type); + drupal_container()->get('language_manager')->reset($type); + } + if (!isset($type)) { + $languages = array(); + } + elseif (isset($languages[$type])) { + unset($languages[$type]); } } - // We can't use drupal_static() here because resetting is not a simple case of - // drupal_static_reset(). - static $languages; - // If no type was passed in, reset the languages array. - if (!$type) { - $languages = array(); + + // If no type is passed (most likely when resetting all types), return. + if (!isset($type)) { + return; + } + + // When the language_manager service exists (is both defined and the 'request' + // scope is active in the container), use it to get the language. Otherwise + // return the default language. + try { + $language_manager = drupal_container()->get('language_manager', Container::NULL_ON_INVALID_REFERENCE); } - // If this is not a multilingual environment or we have not yet entered the - // request scope, just use the default language regardless of $type. - if (!isset($languages[$type])) { - $languages[$type] = language_default(); + catch (DependencyInjectionRuntimeException $e) { + } + + if (isset($language_manager)) { + return $language_manager->getLanguage($type); + } + else { + if (!isset($languages[$type])) { + $languages[$type] = language_default(); + } + return $languages[$type]; } - return $languages[$type]; } /** diff --git a/core/includes/common.inc b/core/includes/common.inc index 7ba47fb..b354b04 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -1599,7 +1599,7 @@ function filter_xss_bad_protocol($string, $decode = TRUE) { * Arbitrary elements may be added using the $args associative array. */ function format_rss_channel($title, $link, $description, $items, $langcode = NULL, $args = array()) { - $langcode = $langcode ? $langcode : language_manager(LANGUAGE_TYPE_CONTENT)->langcode; + $langcode = $langcode ? $langcode : language(LANGUAGE_TYPE_CONTENT)->langcode; $output = "\n"; $output .= ' ' . check_plain($title) . "\n"; @@ -1901,7 +1901,7 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL } if (empty($langcode)) { - $langcode = language_manager(LANGUAGE_TYPE_INTERFACE)->langcode; + $langcode = language(LANGUAGE_TYPE_INTERFACE)->langcode; } switch ($type) { @@ -2077,7 +2077,7 @@ function _format_date_callback(array $matches = NULL, $new_langcode = NULL) { * - 'language': An optional language object. If the path being linked to is * internal to the site, $options['language'] is used to look up the alias * for the URL. If $options['language'] is omitted, the language will be - * obtained from language_manager(LANGUAGE_TYPE_URL). + * obtained from language(LANGUAGE_TYPE_URL). * - 'https': Whether this URL should point to a secure location. If not * defined, the current scheme is used, so the user stays on http or https * respectively. TRUE enforces HTTPS and FALSE enforces HTTP, but HTTPS can @@ -2322,7 +2322,7 @@ function l($text, $path, array $options = array()) { // Append active class. if (($path == current_path() || ($path == '' && drupal_is_front_page())) && - (empty($options['language']) || $options['language']->langcode == language_manager(LANGUAGE_TYPE_URL)->langcode)) { + (empty($options['language']) || $options['language']->langcode == language(LANGUAGE_TYPE_URL)->langcode)) { $options['attributes']['class'][] = 'active'; } @@ -6017,7 +6017,7 @@ function drupal_render_cid_parts($granularity = NULL) { // part. if (language_multilingual()) { foreach (language_types_get_configurable() as $language_type) { - $cid_parts[] = language_manager($language_type)->langcode; + $cid_parts[] = language($language_type)->langcode; } } diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 0b62f51..2fd7b52 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -1069,7 +1069,7 @@ function menu_tree_output($tree) { */ function menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL) { $tree = &drupal_static(__FUNCTION__, array()); - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Use $mlid as a flag for whether the data being loaded is for the whole tree. $mlid = isset($link['mlid']) ? $link['mlid'] : 0; @@ -1180,7 +1180,7 @@ function menu_tree_get_path($menu_name) { function menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail = FALSE) { $tree = &drupal_static(__FUNCTION__, array()); - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Check if the active trail has been overridden for this menu tree. $active_path = menu_tree_get_path($menu_name); @@ -1336,7 +1336,7 @@ function menu_build_tree($menu_name, array $parameters = array()) { function _menu_build_tree($menu_name, array $parameters = array()) { // Static cache of already built menu trees. $trees = &drupal_static(__FUNCTION__, array()); - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Build the cache id; sort parents to prevent duplicate storage and remove // default parameter values. diff --git a/core/includes/path.inc b/core/includes/path.inc index 6f28125..36556a0 100644 --- a/core/includes/path.inc +++ b/core/includes/path.inc @@ -82,7 +82,7 @@ function drupal_lookup_path($action, $path = '', $langcode = NULL) { // language. If we used a language different from the one conveyed by the // requested URL, we might end up being unable to check if there is a path // alias matching the URL path. - $langcode = $langcode ? $langcode : language_manager(LANGUAGE_TYPE_URL)->langcode; + $langcode = $langcode ? $langcode : language(LANGUAGE_TYPE_URL)->langcode; if ($action == 'wipe') { $cache = array(); diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 157dc18..2c17020 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1627,7 +1627,7 @@ function theme_link($variables) { * http://www.w3.org/TR/WCAG-TECHS/H42.html for more information. */ function theme_links($variables) { - $language_url = language_manager(LANGUAGE_TYPE_URL); + $language_url = language(LANGUAGE_TYPE_URL); $links = $variables['links']; $attributes = $variables['attributes']; @@ -2398,7 +2398,7 @@ function _template_preprocess_default_variables() { * @see html.tpl.php */ function template_preprocess_html(&$variables) { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Compile a list of classes that are going to be applied to the body element. // This allows advanced theming based on context (home page, node of certain type, etc.). @@ -2530,7 +2530,7 @@ function template_preprocess_html(&$variables) { * @see page.tpl.php */ function template_preprocess_page(&$variables) { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $site_config = config('system.site'); // Move some variables to the top level for themer convenience and template cleanliness. @@ -2711,7 +2711,7 @@ function theme_get_suggestions($args, $base, $delimiter = '__') { */ function template_preprocess_maintenance_page(&$variables) { global $theme; - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Retrieve the theme data to list all available regions. $theme_data = list_themes(); $regions = $theme_data[$theme]->info['regions']; diff --git a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php index 56d5675..8044a5c 100644 --- a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php @@ -33,7 +33,7 @@ class FinishResponseSubscriber implements EventSubscriberInterface { // @todo Receive the LanguageManager object as a constructor argument when // the dependency injection container allows for it performantly: // http://drupal.org/node/1706064. - $response->headers->set('Content-language', language_manager(LANGUAGE_TYPE_INTERFACE)->langcode); + $response->headers->set('Content-language', language(LANGUAGE_TYPE_INTERFACE)->langcode); // Because pages are highly dynamic, set the last-modified time to now // since the page is in fact being regenerated right now. diff --git a/core/lib/Drupal/Core/Language/LanguageManager.php b/core/lib/Drupal/Core/Language/LanguageManager.php index 7514b74..f00d753 100644 --- a/core/lib/Drupal/Core/Language/LanguageManager.php +++ b/core/lib/Drupal/Core/Language/LanguageManager.php @@ -14,8 +14,8 @@ use Symfony\Component\HttpFoundation\Request; * * This service is dependent on the 'request' service and can therefore pass the * Request object to the code that deals with each particular language type. - * This means the Request can be used directly for things like url-based language - * negotiation. + * This means the Request can be used directly for things like url-based + * language negotiation. */ class LanguageManager { @@ -32,12 +32,22 @@ class LanguageManager { } // @todo Objectify the language system so that we don't have to do this. - include_once DRUPAL_ROOT . '/core/includes/language.inc'; - $this->languages[$type] = language_types_initialize($type, $this->request); + if (language_multilingual()) { + include_once DRUPAL_ROOT . '/core/includes/language.inc'; + $this->languages[$type] = language_types_initialize($type, $this->request); + } + else { + $this->languages[$type] = language_default(); + } return $this->languages[$type]; } - function reset() { - $this->languages = array(); + public function reset($type = NULL) { + if (!isset($type)) { + $this->languages = array(); + } + elseif (isset($this->languages[$type])) { + unset($this->languages[$type]); + } } } diff --git a/core/modules/block/block.api.php b/core/modules/block/block.api.php index bf166c9..858a21b 100644 --- a/core/modules/block/block.api.php +++ b/core/modules/block/block.api.php @@ -329,7 +329,7 @@ function hook_block_view_MODULE_DELTA_alter(&$data, $block) { */ function hook_block_list_alter(&$blocks) { global $theme_key; - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // This example shows how to achieve language specific visibility setting for // blocks. diff --git a/core/modules/block/block.module b/core/modules/block/block.module index 0b90bda..c07b73d 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -880,7 +880,7 @@ function block_block_list_alter(&$blocks) { continue; } foreach ($block_langcodes[$block->module][$block->delta] as $language_type => $langcodes) { - if (isset($langcodes[language_manager($language_type)->langcode])) { + if (isset($langcodes[language($language_type)->langcode])) { // Found a language type - langcode combination in the configuration // that is applicable to the current request. continue 2; diff --git a/core/modules/book/book.module b/core/modules/book/book.module index 949f81c..0b46982 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -1224,7 +1224,7 @@ function book_toc($bid, $depth_limit, $exclude = array()) { */ function template_preprocess_book_export_html(&$variables) { global $base_url; - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $variables['title'] = check_plain($variables['title']); $variables['base_url'] = $base_url; diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index b46beff..39faf90 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -959,7 +959,7 @@ function comment_prepare_thread(&$comments) { */ function comment_view(Comment $comment, Node $node, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { - $langcode = language_manager(LANGUAGE_TYPE_CONTENT)->langcode; + $langcode = language(LANGUAGE_TYPE_CONTENT)->langcode; } // Populate $comment->content with a render() array. @@ -1025,7 +1025,7 @@ function comment_view(Comment $comment, Node $node, $view_mode = 'full', $langco */ function comment_build_content(Comment $comment, Node $node, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { - $langcode = language_manager(LANGUAGE_TYPE_CONTENT)->langcode; + $langcode = language(LANGUAGE_TYPE_CONTENT)->langcode; } // Remove previously built content, if exists. @@ -1683,7 +1683,7 @@ function comment_forms() { */ function comment_form($form, &$form_state, Comment $comment) { global $user; - $language_content = language_manager(LANGUAGE_TYPE_CONTENT); + $language_content = language(LANGUAGE_TYPE_CONTENT); // During initial form build, add the comment entity to the form state for // use during form building and processing. During a rebuild, use what is in diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php index 50a7b55..383786c 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php @@ -23,7 +23,7 @@ class CommentTokenReplaceTest extends CommentTestBase { * Creates a comment, then tests the tokens generated from it. */ function testCommentTokenReplacement() { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $url_options = array( 'absolute' => TRUE, 'language' => $language_interface, diff --git a/core/modules/contact/contact.pages.inc b/core/modules/contact/contact.pages.inc index 8962298..92d73bc 100644 --- a/core/modules/contact/contact.pages.inc +++ b/core/modules/contact/contact.pages.inc @@ -150,7 +150,7 @@ function contact_site_form_validate($form, &$form_state) { */ function contact_site_form_submit($form, &$form_state) { global $user; - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $values = $form_state['values']; $values['sender'] = $user; @@ -292,7 +292,7 @@ function contact_personal_form($form, &$form_state, $recipient) { */ function contact_personal_form_submit($form, &$form_state) { global $user; - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $values = $form_state['values']; $values['sender'] = $user; diff --git a/core/modules/entity/entity.module b/core/modules/entity/entity.module index 53f5fe4..dec1913 100644 --- a/core/modules/entity/entity.module +++ b/core/modules/entity/entity.module @@ -48,7 +48,7 @@ function entity_modules_disabled() { * @see hook_entity_info_alter() */ function entity_get_info($entity_type = NULL) { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Use the advanced drupal_static() pattern, since this is called very often. static $drupal_static_fast; diff --git a/core/modules/field/field.info.inc b/core/modules/field/field.info.inc index 0f04c56..a70796f 100644 --- a/core/modules/field/field.info.inc +++ b/core/modules/field/field.info.inc @@ -67,7 +67,7 @@ function field_info_cache_clear() { * @see _field_info_collate_types_reset() */ function _field_info_collate_types() { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Use the advanced drupal_static() pattern, since this is called very often. static $drupal_static_fast; diff --git a/core/modules/field/field.multilingual.inc b/core/modules/field/field.multilingual.inc index 533c881..796f68a 100644 --- a/core/modules/field/field.multilingual.inc +++ b/core/modules/field/field.multilingual.inc @@ -258,7 +258,7 @@ function field_valid_language($langcode, $default = TRUE) { if (in_array($langcode, $languages)) { return $langcode; } - return $default ? language_default()->langcode : language_manager(LANGUAGE_TYPE_CONTENT)->langcode; + return $default ? language_default()->langcode : language(LANGUAGE_TYPE_CONTENT)->langcode; } /** diff --git a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php index c7df161..4efd9c5 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php @@ -23,7 +23,7 @@ class FileTokenReplaceTest extends FileFieldTestBase { * Creates a file, then tests the tokens generated from it. */ function testFileTokenReplacement() { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $url_options = array( 'absolute' => TRUE, 'language' => $language_interface, diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index dc57eeb..4d9bfef 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -399,7 +399,7 @@ function filter_modules_disabled($modules) { * @see filter_formats_reset() */ function filter_formats($account = NULL) { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $formats = &drupal_static(__FUNCTION__, array()); // All available formats are cached for performance. diff --git a/core/modules/image/image.module b/core/modules/image/image.module index ac12e54..fef8c93 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -965,7 +965,7 @@ function image_style_path($style_name, $uri) { * @see image_effect_definition_load() */ function image_effect_definitions() { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // hook_image_effect_info() includes translated strings, so each language is // cached separately. diff --git a/core/modules/language/language.module b/core/modules/language/language.module index da0365f..3fb39e0 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -243,7 +243,7 @@ function language_delete($langcode) { * and checks to see if a related right to left CSS file should be included. */ function language_css_alter(&$css) { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // If the current language is RTL, add the CSS file with the RTL overrides. if ($language_interface->direction == LANGUAGE_RTL) { diff --git a/core/modules/language/language.negotiation.inc b/core/modules/language/language.negotiation.inc index 4e6cda8..48a8083 100644 --- a/core/modules/language/language.negotiation.inc +++ b/core/modules/language/language.negotiation.inc @@ -52,7 +52,7 @@ const LANGUAGE_NEGOTIATION_URL_DOMAIN = 1; * The current interface language code. */ function language_from_interface() { - return language_manager(LANGUAGE_TYPE_INTERFACE)->langcode; + return language(LANGUAGE_TYPE_INTERFACE)->langcode; } /** @@ -304,7 +304,7 @@ function language_url_fallback($language = NULL, $request = NULL, $language_type return $default->langcode; } else { - $langcode = language_manager($language_type)->langcode; + $langcode = language($language_type)->langcode; return $langcode; } } @@ -335,7 +335,7 @@ function language_switcher_url($type, $path) { */ function language_switcher_session($type, $path) { $param = variable_get('language_negotiation_session_param', 'language'); - $language_query = isset($_SESSION[$param]) ? $_SESSION[$param] : language_manager($type)->langcode; + $language_query = isset($_SESSION[$param]) ? $_SESSION[$param] : language($type)->langcode; $languages = language_list(); $links = array(); @@ -378,7 +378,7 @@ function language_url_rewrite_url(&$path, &$options) { // Language can be passed as an option, or we go for current URL language. if (!isset($options['language'])) { - $language_url = language_manager(LANGUAGE_TYPE_URL); + $language_url = language(LANGUAGE_TYPE_URL); $options['language'] = $language_url; } // We allow only enabled languages here. diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageDependencyInjectionTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageDependencyInjectionTest.php index bd940d3..94015dc 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageDependencyInjectionTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageDependencyInjectionTest.php @@ -27,7 +27,7 @@ class LanguageDependencyInjectionTest extends WebTestBase { parent::setUp('language'); // Ensure we are building a new Language object for each test. - language_manager(); + language(NULL, TRUE); } @@ -41,7 +41,7 @@ class LanguageDependencyInjectionTest extends WebTestBase { drupal_language_initialize(); $expected = language_default(); - $result = language_manager(LANGUAGE_TYPE_INTERFACE); + $result = language(LANGUAGE_TYPE_INTERFACE); foreach ($expected as $property => $value) { $this->assertEqual($expected->$property, $result->$property, t('The dependency injected language object %prop property equals the new Language object %prop property.', array('%prop' => $property))); } @@ -71,7 +71,7 @@ class LanguageDependencyInjectionTest extends WebTestBase { // The langauge system creates a Language object which contains the // same properties as the new default language object. $expected = new Language($new_language_default); - $result = language_manager(LANGUAGE_TYPE_INTERFACE); + $result = language(LANGUAGE_TYPE_INTERFACE); foreach ($expected as $property => $value) { $this->assertEqual($expected->$property, $result->$property, t('The dependency injected language object %prop property equals the default language object %prop property.', array('%prop' => $property))); } diff --git a/core/modules/language/tests/language_test.module b/core/modules/language/tests/language_test.module index cc2e8ad..be0a8c0 100644 --- a/core/modules/language/tests/language_test.module +++ b/core/modules/language/tests/language_test.module @@ -22,8 +22,8 @@ function language_test_boot() { */ function language_test_init() { language_test_store_language_negotiation(); - if (isset(language_manager(LANGUAGE_TYPE_INTERFACE)->langcode) && isset(language_manager(LANGUAGE_TYPE_INTERFACE)->method_id)) { - drupal_set_message(t('Language negotiation method: @name', array('@name' => language_manager(LANGUAGE_TYPE_INTERFACE)->method_id))); + if (isset(language(LANGUAGE_TYPE_INTERFACE)->langcode) && isset(language(LANGUAGE_TYPE_INTERFACE)->method_id)) { + drupal_set_message(t('Language negotiation method: @name', array('@name' => language(LANGUAGE_TYPE_INTERFACE)->method_id))); } } @@ -95,7 +95,7 @@ function language_test_language_negotiation_info_alter(array &$negotiation_info) function language_test_store_language_negotiation() { $last = array(); foreach (language_types_get_all() as $type) { - $last[$type] = language_manager($type)->langcode; + $last[$type] = language($type)->langcode; } variable_set('language_test_language_negotiation_last', $last); } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php index c52f483..9092bf4 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php @@ -46,12 +46,11 @@ class LocaleUninstallTest extends WebTestBase { 'default' => $this->langcode == 'fr', ); language_save($language); - // Reset the language_manager so that the language interface object gets - // freshly initialized. - language_manager(); + // Reset statically cached language objects. + language(NULL, TRUE); // Check the UI language. drupal_language_initialize(); - $this->assertEqual(language_manager(LANGUAGE_TYPE_INTERFACE)->langcode, $this->langcode, t('Current language: %lang', array('%lang' => language_manager(LANGUAGE_TYPE_INTERFACE)->langcode))); + $this->assertEqual(language(LANGUAGE_TYPE_INTERFACE)->langcode, $this->langcode, t('Current language: %lang', array('%lang' => language(LANGUAGE_TYPE_INTERFACE)->langcode))); // Enable multilingual workflow option for articles. variable_set('node_type_language_hidden_article',FALSE); @@ -93,12 +92,11 @@ class LocaleUninstallTest extends WebTestBase { // Visit the front page. $this->drupalGet(''); - // Reset the language_manager so that the language interface object gets - // freshly initialized. - language_manager(); + // Reset statically cached language objects. + language(NULL, TRUE); // Check the init language logic. drupal_language_initialize(); - $this->assertEqual(language_manager(LANGUAGE_TYPE_INTERFACE)->langcode, 'en', t('Language after uninstall: %lang', array('%lang' => language_manager(LANGUAGE_TYPE_INTERFACE)->langcode))); + $this->assertEqual(language(LANGUAGE_TYPE_INTERFACE)->langcode, 'en', t('Language after uninstall: %lang', array('%lang' => language(LANGUAGE_TYPE_INTERFACE)->langcode))); // Check JavaScript files deletion. $this->assertTrue($result = !file_exists($js_file), t('JavaScript file deleted: %file', array('%file' => $result ? $js_file : t('found')))); diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index ad5ad91..f7c22c1 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -232,7 +232,7 @@ function locale_language_delete($language) { * Language code to use for the lookup. */ function locale($string = NULL, $context = NULL, $langcode = NULL) { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Use the advanced drupal_static() pattern, since this is called very often. static $drupal_static_fast; @@ -280,7 +280,7 @@ function locale_reset() { * plural formula. */ function locale_get_plural($count, $langcode = NULL) { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Used to locally cache the plural formulas for all languages. $plural_formulas = &drupal_static(__FUNCTION__, array()); @@ -366,7 +366,7 @@ function locale_system_update($components) { * file if necessary, and adds it to the page. */ function locale_js_alter(&$javascript) { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $dir = 'public://' . variable_get('locale_js_directory', 'languages'); $parsed = variable_get('javascript_parsed', array()); @@ -426,7 +426,7 @@ function locale_js_alter(&$javascript) { */ function locale_library_info_alter(&$libraries, $module) { if ($module == 'system' && isset($libraries['jquery.ui.datepicker'])) { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // locale.datepicker.js should be added in the JS_LIBRARY group, so that // this attach behavior will execute early. JS_LIBRARY is the default for // hook_library_info_alter(), thus does not have to be specified explicitly. @@ -572,7 +572,7 @@ function locale_form_system_file_system_settings_alter(&$form, $form_state) { */ function locale_preprocess_node(&$variables) { if ($variables['langcode'] != LANGUAGE_NOT_SPECIFIED) { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $node_language = language_load($variables['langcode']); if ($node_language->langcode != $language_interface->langcode) { @@ -771,7 +771,7 @@ function _locale_invalidate_js($langcode = NULL) { */ function _locale_rebuild_js($langcode = NULL) { if (!isset($langcode)) { - $language = language_manager(LANGUAGE_TYPE_INTERFACE); + $language = language(LANGUAGE_TYPE_INTERFACE); } else { // Get information about the locale. diff --git a/core/modules/locale/locale.pages.inc b/core/modules/locale/locale.pages.inc index 25f45fc..539c382 100644 --- a/core/modules/locale/locale.pages.inc +++ b/core/modules/locale/locale.pages.inc @@ -103,7 +103,7 @@ function locale_translate_filters() { } // Pick the current interface language code for the filter. - $default_langcode = language_manager(LANGUAGE_TYPE_INTERFACE)->langcode; + $default_langcode = language(LANGUAGE_TYPE_INTERFACE)->langcode; if (!isset($language_options[$default_langcode])) { $available_langcodes = array_keys($language_options); $default_langcode = array_shift($available_langcodes); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php index 3eeaf26..4174ee6 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php @@ -23,7 +23,7 @@ class NodeTokenReplaceTest extends NodeTestBase { * Creates a node, then tests the tokens generated from it. */ function testNodeTokenReplacement() { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $url_options = array( 'absolute' => TRUE, 'language' => $language_interface, diff --git a/core/modules/node/node.module b/core/modules/node/node.module index d1dfdc2..2c94427 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -673,7 +673,7 @@ function node_field_extra_fields() { function node_type_get_default_langcode($node_type) { $default_value = variable_get('node_type_language_default_' . $node_type, 'site_default'); - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); if ($default_value == LANGUAGE_NOT_SPECIFIED) { return LANGUAGE_NOT_SPECIFIED; @@ -763,7 +763,7 @@ function node_type_update_nodes($old_type, $type) { * type object by $type->disabled being set to TRUE. */ function _node_types_build($rebuild = FALSE) { - $cid = 'node_types:' . language_manager(LANGUAGE_TYPE_INTERFACE)->langcode; + $cid = 'node_types:' . language(LANGUAGE_TYPE_INTERFACE)->langcode; if (!$rebuild) { $_node_types = &drupal_static(__FUNCTION__); @@ -1206,7 +1206,7 @@ function node_revision_delete($revision_id) { */ function node_view(Node $node, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { - $langcode = language_manager(LANGUAGE_TYPE_CONTENT)->langcode; + $langcode = language(LANGUAGE_TYPE_CONTENT)->langcode; } // Populate $node->content with a render() array. @@ -1267,7 +1267,7 @@ function node_view(Node $node, $view_mode = 'full', $langcode = NULL) { */ function node_build_content(Node $node, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { - $langcode = language_manager(LANGUAGE_TYPE_CONTENT)->langcode; + $langcode = language(LANGUAGE_TYPE_CONTENT)->langcode; } // Remove previously built content, if exists. @@ -2470,7 +2470,7 @@ function node_block_list_alter(&$blocks) { */ function node_feed($nids = FALSE, $channel = array()) { global $base_url; - $language_content = language_manager(LANGUAGE_TYPE_CONTENT); + $language_content = language(LANGUAGE_TYPE_CONTENT); $rss_config = config('system.rss'); if ($nids === FALSE) { diff --git a/core/modules/openid/openid.inc b/core/modules/openid/openid.inc index f6dc2a5..9f8dcac 100644 --- a/core/modules/openid/openid.inc +++ b/core/modules/openid/openid.inc @@ -83,7 +83,7 @@ function openid_redirect_http($url, $message) { * Creates a js auto-submit redirect for (for the 2.x protocol) */ function openid_redirect($url, $message) { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $output = '' . "\n"; $output .= '' . "\n"; diff --git a/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php b/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php index 56e0854..ea3e7dc 100644 --- a/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php +++ b/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php @@ -23,7 +23,7 @@ class PollTokenReplaceTest extends PollTestBase { * Creates a poll, then tests the tokens generated from it. */ function testPollTokenReplacement() { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Craete a poll with three choices. $title = $this->randomName(); diff --git a/core/modules/search/search.pages.inc b/core/modules/search/search.pages.inc index 9e24c2a..337fe85 100644 --- a/core/modules/search/search.pages.inc +++ b/core/modules/search/search.pages.inc @@ -104,7 +104,7 @@ function template_preprocess_search_results(&$variables) { * @see search-result.tpl.php */ function template_preprocess_search_result(&$variables) { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $result = $variables['result']; $variables['url'] = check_url($result['link']); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php index cccd011..f58e1de 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php @@ -680,7 +680,7 @@ abstract class TestBase { */ protected function prepareEnvironment() { global $user, $conf; - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Backup current in-memory configuration. $this->originalConf = $conf; @@ -748,7 +748,7 @@ abstract class TestBase { */ protected function tearDown() { global $user, $conf; - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // In case a fatal error occurred that was not in the test process read the // log to pick up any fatal errors. diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index eda2365..877c3cb 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -579,7 +579,7 @@ abstract class WebTestBase extends TestBase { */ protected function setUp() { global $user, $conf; - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Create the database prefix for this test. $this->prepareDatabasePrefix(); diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php index fcfc21e..516c292 100644 --- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php +++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php @@ -23,7 +23,7 @@ class StatisticsTokenReplaceTest extends StatisticsTestBase { * Creates a node, then tests the statistics tokens generated from it. */ function testStatisticsTokenReplacement() { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Create user and node. $user = $this->drupalCreateUser(array('create page content')); diff --git a/core/modules/system/language.api.php b/core/modules/system/language.api.php index 8a13da3..16d0794 100644 --- a/core/modules/system/language.api.php +++ b/core/modules/system/language.api.php @@ -26,7 +26,7 @@ function hook_language_init() { global $conf; - switch (language_manager(LANGUAGE_TYPE_INTERFACE)->langcode) { + switch (language(LANGUAGE_TYPE_INTERFACE)->langcode) { case 'it': $conf['system.site']['name'] = 'Il mio sito Drupal'; break; @@ -52,7 +52,7 @@ function hook_language_init() { * The current path. */ function hook_language_switch_links_alter(array &$links, $type, $path) { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); if ($type == LANGUAGE_TYPE_CONTENT && isset($links[$language_interface->langcode])) { foreach ($links[$language_interface->langcode] as $link) { diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php index 8452c41..5742a7e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php @@ -222,7 +222,7 @@ class CascadingStylesheetsTest extends WebTestBase { */ function testAlter() { // Switch the language to a right to left language and add system.base.css. - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $language_interface->direction = LANGUAGE_RTL; $path = drupal_get_path('module', 'system'); drupal_add_css($path . '/system.base.css'); diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php index 5bfb9b6..ab94150 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php @@ -72,7 +72,7 @@ class FormatDateTest extends WebTestBase { function testFormatDate() { global $user; - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $timestamp = strtotime('2007-03-26T00:00:00+00:00'); $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', 'en'), 'Sunday, 25-Mar-07 17:00:00 PDT', t('Test all parameters.')); diff --git a/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php b/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php index ac1e611..00a164c 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php @@ -41,7 +41,7 @@ class MailTest extends WebTestBase implements MailInterface { * Assert that the pluggable mail system is functional. */ public function testPluggableFramework() { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Use MailTestCase for sending a message. $message = drupal_mail('simpletest', 'mail_test', 'testing@example.com', $language_interface); diff --git a/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php b/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php index a4e2917..16eb0f2 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php @@ -30,7 +30,7 @@ class TokenReplaceTest extends WebTestBase { $node = $this->drupalCreateNode(array('uid' => $account->uid)); $node->title = 'Blinking Text'; global $user; - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $source = '[node:title]'; // Title of the node we passed in $source .= '[node:author:name]'; // Node author's name @@ -75,7 +75,7 @@ class TokenReplaceTest extends WebTestBase { * Test whether token-replacement works in various contexts. */ function testSystemTokenRecognition() { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Generate prefixes and suffixes for the token context. $tests = array( @@ -104,7 +104,7 @@ class TokenReplaceTest extends WebTestBase { * Tests the generation of all system site information tokens. */ function testSystemSiteTokenReplacement() { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $url_options = array( 'absolute' => TRUE, 'language' => $language_interface, @@ -147,7 +147,7 @@ class TokenReplaceTest extends WebTestBase { * Tests the generation of all system date tokens. */ function testSystemDateTokenReplacement() { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Set time to one hour before request. $date = REQUEST_TIME - 3600; diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index 0dc087d..142a366 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -1896,7 +1896,7 @@ function hook_custom_theme() { */ function hook_watchdog(array $log_entry) { global $base_url; - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $severity_list = array( WATCHDOG_EMERGENCY => t('Emergency'), diff --git a/core/modules/system/system.module b/core/modules/system/system.module index fe61ad1..804575c 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2069,7 +2069,7 @@ function system_filetransfer_info() { function system_init() { global $conf; - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // For each date type (e.g. long, short), get the localized date format // for the user's current language and override the default setting for it // in $conf. This should happen on all pages except the date and time formats diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php index 6e2594f..4f882ca 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php @@ -62,7 +62,7 @@ class TokenReplaceTest extends TaxonomyTestBase { * Creates some terms and a node, then tests the tokens generated from them. */ function testTaxonomyTokenReplacement() { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); // Create two taxonomy terms. $term1 = $this->createTerm($this->vocabulary); diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 66c78e1..9f927a7 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -586,7 +586,7 @@ function taxonomy_term_delete_multiple(array $tids) { */ function taxonomy_term_view(Term $term, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { - $langcode = language_manager(LANGUAGE_TYPE_CONTENT)->langcode; + $langcode = language(LANGUAGE_TYPE_CONTENT)->langcode; } field_attach_prepare_view('taxonomy_term', array($term->tid => $term), $view_mode, $langcode); diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php index f257118..974d92e 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php @@ -25,7 +25,7 @@ class UserTokenReplaceTest extends WebTestBase { * Creates a user, then tests the tokens generated from it. */ function testUserTokenReplacement() { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $url_options = array( 'absolute' => TRUE, 'language' => $language_interface, diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 4e8df24..1f72aa6 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -710,7 +710,7 @@ function user_user_view($account) { */ function user_account_form(&$form, &$form_state) { global $user; - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $account = $form['#user']; $register = ($form['#user']->uid > 0 ? FALSE : TRUE); @@ -2374,7 +2374,7 @@ function user_view_page($account) { */ function user_view($account, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { - $langcode = language_manager(LANGUAGE_TYPE_CONTENT)->langcode; + $langcode = language(LANGUAGE_TYPE_CONTENT)->langcode; } // Retrieve all profile fields and attach to $account->content. @@ -2410,7 +2410,7 @@ function user_view($account, $view_mode = 'full', $langcode = NULL) { */ function user_build_content($account, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { - $langcode = language_manager(LANGUAGE_TYPE_CONTENT)->langcode; + $langcode = language(LANGUAGE_TYPE_CONTENT)->langcode; } // Remove previously built content, if exists. diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc index 783e3ff..434de72 100644 --- a/core/modules/user/user.pages.inc +++ b/core/modules/user/user.pages.inc @@ -77,7 +77,7 @@ function user_pass_validate($form, &$form_state) { } function user_pass_submit($form, &$form_state) { - $language_interface = language_manager(LANGUAGE_TYPE_INTERFACE); + $language_interface = language(LANGUAGE_TYPE_INTERFACE); $account = $form_state['values']['account']; // Mail one time login URL and instructions using current language.