You are here

function _admin_language_switch_language in Administration Language 6

Same name and namespace in other branches
  1. 7 admin_language.module \_admin_language_switch_language()

Determine whether the language needs to be switched on the current path.

Return value

boolean TRUE to switch to the selected administration language or FALSE to use the default language.

1 call to _admin_language_switch_language()
admin_language_init in ./admin_language.module
Implementation of hook_init().

File

./admin_language.module, line 494
Makes sure all admin pages are displayed in the preferred language of the administrator.

Code

function _admin_language_switch_language() {
  $switch = FALSE;
  $visibility = variable_get('admin_language_visibility', ADMIN_LANGUAGE_SOME_PAGES);
  $pages = variable_get('admin_language_pages', ADMIN_LANGUAGE_DEFAULT_PAGES);
  if ($pages) {
    $path = drupal_get_path_alias($_GET['q']);
    $switch = drupal_match_path($path, $pages);
    if ($path != $_GET['q']) {
      $switch = $switch || drupal_match_path($_GET['q'], $pages);
    }
    $switch = !($visibility xor $switch);
  }
  else {
    $switch = TRUE;
    $switch = ($visibility xor $switch);
  }
  return $switch;
}