summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/bootstrap.inc10
-rw-r--r--includes/language.inc21
-rw-r--r--includes/locale.inc6
-rw-r--r--includes/menu.inc6
-rw-r--r--includes/path.inc4
5 files changed, 32 insertions, 15 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index ad0441d0c..5dd22249d 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -189,12 +189,12 @@ define('LANGUAGE_NONE', 'und');
/**
* The type of language used to define the content language.
*/
-define('LANGUAGE_TYPE_CONTENT', 'language');
+define('LANGUAGE_TYPE_CONTENT', 'language_content');
/**
* The type of language used to select the user interface.
*/
-define('LANGUAGE_TYPE_INTERFACE', 'language_interface');
+define('LANGUAGE_TYPE_INTERFACE', 'language');
/**
* The type of language used for URLs.
@@ -1379,12 +1379,12 @@ function drupal_unpack($obj, $field = 'data') {
* The translated string.
*/
function t($string, array $args = array(), array $options = array()) {
- global $language_interface;
+ global $language;
static $custom_strings;
// Merge in default.
if (empty($options['langcode'])) {
- $options['langcode'] = isset($language_interface->language) ? $language_interface->language : 'en';
+ $options['langcode'] = isset($language->language) ? $language->language : 'en';
}
if (empty($options['context'])) {
$options['context'] = '';
@@ -2081,8 +2081,8 @@ function drupal_language_initialize() {
*/
function drupal_language_types() {
return array(
- LANGUAGE_TYPE_CONTENT => TRUE,
LANGUAGE_TYPE_INTERFACE => TRUE,
+ LANGUAGE_TYPE_CONTENT => FALSE,
LANGUAGE_TYPE_URL => FALSE,
);
}
diff --git a/includes/language.inc b/includes/language.inc
index 52b5bd6ce..608ed112e 100644
--- a/includes/language.inc
+++ b/includes/language.inc
@@ -37,17 +37,34 @@ function language_types_info() {
* whose negotiation values are unchangeable and defined while defining the
* language type itself.
*
+ * @param $stored
+ * Optional. By default retrieves values from the 'language_types' variable to
+ * avoid unnecessary hook invocations.
+ * If set to FALSE retrieves values from the actual language type definitions.
+ * This allows to react to alterations performed on the definitions by modules
+ * installed after the 'language_types' variable is set.
+ *
* @return
* An array of language type names.
*/
-function language_types_configurable() {
+function language_types_configurable($stored = TRUE) {
$configurable = &drupal_static(__FUNCTION__);
- if (!isset($configurable)) {
+ if ($stored && !isset($configurable)) {
$types = variable_get('language_types', drupal_language_types());
$configurable = array_keys(array_filter($types));
}
+ if (!$stored) {
+ $result = array();
+ foreach (language_types_info() as $type => $info) {
+ if (!isset($info['fixed'])) {
+ $result[] = $type;
+ }
+ }
+ return $result;
+ }
+
return $configurable;
}
diff --git a/includes/locale.inc b/includes/locale.inc
index c8b451eef..4c52b9cc9 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -41,12 +41,12 @@ define('LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN', 1);
*/
/**
- * Identify the language from the current content language.
+ * Identifies the language from the current interface language.
*
* @return
- * The current content language code.
+ * The current interface language code.
*/
-function locale_language_from_content() {
+function locale_language_from_interface() {
global $language;
return isset($language->language) ? $language->language : FALSE;
}
diff --git a/includes/menu.inc b/includes/menu.inc
index dedb04a10..c3ba10123 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -969,7 +969,7 @@ function menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL) {
// Use $mlid as a flag for whether the data being loaded is for the whole tree.
$mlid = isset($link['mlid']) ? $link['mlid'] : 0;
// Generate a cache ID (cid) specific for this $menu_name, $link, $language, and depth.
- $cid = 'links:' . $menu_name . ':all-cid:' . $mlid . ':' . $GLOBALS['language_interface']->language . ':' . (int)$max_depth;
+ $cid = 'links:' . $menu_name . ':all-cid:' . $mlid . ':' . $GLOBALS['language']->language . ':' . (int)$max_depth;
if (!isset($tree[$cid])) {
// If the static variable doesn't have the data, check {cache_menu}.
@@ -1081,7 +1081,7 @@ function menu_tree_page_data($menu_name, $max_depth = NULL) {
$max_depth = min($max_depth, MENU_MAX_DEPTH);
}
// Generate a cache ID (cid) specific for this page.
- $cid = 'links:' . $menu_name . ':page-cid:' . $item['href'] . ':' . $GLOBALS['language_interface']->language . ':' . (int)$item['access'] . ':' . (int)$max_depth;
+ $cid = 'links:' . $menu_name . ':page-cid:' . $item['href'] . ':' . $GLOBALS['language']->language . ':' . (int)$item['access'] . ':' . (int)$max_depth;
if (!isset($tree[$cid])) {
// If the static variable doesn't have the data, check {cache_menu}.
@@ -1229,7 +1229,7 @@ function menu_tree_page_data($menu_name, $max_depth = NULL) {
* Helper function - compute the real cache ID for menu tree data.
*/
function _menu_tree_cid($menu_name, $data) {
- return 'links:' . $menu_name . ':tree-data:' . $GLOBALS['language_interface']->language . ':' . md5(serialize($data));
+ return 'links:' . $menu_name . ':tree-data:' . $GLOBALS['language']->language . ':' . md5(serialize($data));
}
/**
diff --git a/includes/path.inc b/includes/path.inc
index 35a8dcffb..240f375f0 100644
--- a/includes/path.inc
+++ b/includes/path.inc
@@ -44,7 +44,7 @@ function drupal_path_initialize() {
* found.
*/
function drupal_lookup_path($action, $path = '', $path_language = NULL) {
- global $language;
+ global $language_content;
// Use the advanced drupal_static() pattern, since this is called very often.
static $drupal_static_fast;
if (!isset($drupal_static_fast)) {
@@ -71,7 +71,7 @@ function drupal_lookup_path($action, $path = '', $path_language = NULL) {
}
}
- $path_language = $path_language ? $path_language : $language->language;
+ $path_language = $path_language ? $path_language : $language_content->language;
if ($action == 'wipe') {
$cache = array();