Commit 112050be authored by tim.plunkett's avatar tim.plunkett

Issue #1717686 by aspilicious, tim.plunkett: Make use of the new language_manager().

parent f1234cdf
......@@ -132,7 +132,7 @@ function views_cache_set($cid, $data, $use_language = FALSE) {
return;
}
if ($use_language) {
$cid .= ':' . drupal_container()->get(LANGUAGE_TYPE_INTERFACE)->langcode;
$cid .= ':' . language_manager(LANGUAGE_TYPE_INTERFACE)->langcode;
}
cache('cache_views')->set($cid, $data);
......@@ -156,7 +156,7 @@ function views_cache_get($cid, $use_language = FALSE) {
return FALSE;
}
if ($use_language) {
$cid .= ':' . drupal_container()->get(LANGUAGE_TYPE_INTERFACE)->langcode;
$cid .= ':' . language_manager(LANGUAGE_TYPE_INTERFACE)->langcode;
}
return cache('cache_views')->get($cid);
......
......@@ -241,7 +241,7 @@ function query($use_groupby = FALSE) {
// @see this::field_language()
$default_language = language_default()->langcode;
$language = str_replace(array('***CURRENT_LANGUAGE***', '***DEFAULT_LANGUAGE***'),
array(drupal_container()->get(LANGUAGE_TYPE_CONTENT)->langcode, $default_language),
array(language_manager(LANGUAGE_TYPE_CONTENT)->langcode, $default_language),
$this->view->display_handler->options['field_language']);
$placeholder = $this->placeholder();
$language_fallback_candidates = array($language);
......@@ -919,7 +919,7 @@ function field_language($entity_type, $entity) {
if (field_is_translatable($entity_type, $this->field_info)) {
$default_language = language_default()->langcode;
$language = str_replace(array('***CURRENT_LANGUAGE***', '***DEFAULT_LANGUAGE***'),
array(drupal_container()->get(LANGUAGE_TYPE_CONTENT)->langcode, $default_language),
array(language_manager(LANGUAGE_TYPE_CONTENT)->langcode, $default_language),
$this->view->display_handler->options['field_language']);
// Give the Field Language API a chance to fallback to a different language
......
......@@ -30,7 +30,7 @@ function render($values) {
}
function render_link($data, $values) {
$language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE);
$language_interface = language_manager(LANGUAGE_TYPE_INTERFACE);
$tnid = $this->get_value($values, 'tnid');
// Only load translations if the node isn't in the current language.
......
......@@ -283,7 +283,7 @@ function get_results_key() {
'build_info' => $build_info,
'roles' => array_keys($user->roles),
'super-user' => $user->uid == 1, // special caching for super user.
'language' => drupal_container()->get(LANGUAGE_TYPE_INTERFACE)->langcode,
'language' => language_manager(LANGUAGE_TYPE_INTERFACE)->langcode,
'base_url' => $GLOBALS['base_url'],
);
foreach (array('exposed_info', 'page', 'sort', 'order', 'items_per_page', 'offset') as $key) {
......@@ -306,7 +306,7 @@ function get_output_key() {
'roles' => array_keys($user->roles),
'super-user' => $user->uid == 1, // special caching for super user.
'theme' => $GLOBALS['theme'],
'language' => drupal_container()->get(LANGUAGE_TYPE_INTERFACE)->langcode,
'language' => language_manager(LANGUAGE_TYPE_INTERFACE)->langcode,
'base_url' => $GLOBALS['base_url'],
);
......
......@@ -39,7 +39,7 @@ function translate_string($string, $keys = array(), $format = '') {
* The input format of the string. This is optional.
*/
function save_string($string, $keys = array(), $format = '') {
$language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE);
$language_interface = language_manager(LANGUAGE_TYPE_INTERFACE);
// If the current language is 'en', we need to reset the language
// in order to trigger an update.
......@@ -50,14 +50,16 @@ function save_string($string, $keys = array(), $format = '') {
$cached_language = $language_interface;
unset($languages['en']);
if (!empty($languages)) {
drupal_container()->set(LANGUAGE_TYPE_INTERFACE, current($languages));
// @todo Rewrite this code.
//drupal_container()->set(LANGUAGE_TYPE_INTERFACE, current($languages));
}
}
t($string);
if (isset($cached_language)) {
drupal_container()->set(LANGUAGE_TYPE_INTERFACE, $cached_language);
// @todo Rewrite this code.
//drupal_container()->set(LANGUAGE_TYPE_INTERFACE, $cached_language);
}
return TRUE;
}
......
......@@ -884,7 +884,7 @@ function template_preprocess_views_view_rss(&$vars) {
$vars['link'] = check_url(url($path, $url_options));
}
$vars['langcode'] = check_plain(drupal_container()->get(LANGUAGE_TYPE_INTERFACE)->langcode);
$vars['langcode'] = check_plain(language_manager(LANGUAGE_TYPE_INTERFACE)->langcode);
$vars['namespaces'] = drupal_attributes($style->namespaces);
$vars['items'] = $items;
$vars['channel_elements'] = format_xml_elements($style->channel_elements);
......
......@@ -789,7 +789,7 @@ function hook_views_query_substitutions($view) {
return array(
'***CURRENT_VERSION***' => VERSION,
'***CURRENT_TIME***' => REQUEST_TIME,
'***CURRENT_LANGUAGE***' => drupal_container()->get(LANGUAGE_TYPE_CONTENT)->langcode,
'***CURRENT_LANGUAGE***' => language_manager(LANGUAGE_TYPE_CONTENT)->langcode,
'***DEFAULT_LANGUAGE***' => language_default()->langcode,
);
}
......
......@@ -2115,7 +2115,7 @@ function views_views_query_substitutions($view) {
return array(
'***CURRENT_VERSION***' => VERSION,
'***CURRENT_TIME***' => REQUEST_TIME,
'***CURRENT_LANGUAGE***' => drupal_container()->get(LANGUAGE_TYPE_CONTENT)->langcode,
'***CURRENT_LANGUAGE***' => language_manager(LANGUAGE_TYPE_CONTENT)->langcode,
'***DEFAULT_LANGUAGE***' => language_default()->langcode,
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment