Question: I'm using i8n to host a bilingual site and I only like to display the inactive language in the top bar. What php code do I need to detect the current language so I place the inactive language in the template? 
Thanks:

```
<a href=
<?php
global $language; 
if (($language -> name) == 'English') { 
print "\"http://www.mangallery.net/fr\"".">french";
} else {
print '"http://www.mangallery.net"'.">english";
}
?>
</a>

```

Answer: 
Use the global variable `$language`

<https://api.drupal.org/api/drupal/developer%21globals.php/global/language/7>
If you are planning to use the existing **Language switcher** block of Drupal which links directly to the translated page(s) on a multilingual website, here is some sample code to remove the active language from the list.

You can add this code in the `template.php` of your theme. Replace `YOURTHEME` with the name of your theme and don't forget to clear the cache.

```
function YOURTHEME_preprocess_links(&$variables)
{
    if (!isset($variables['attributes']['class']['0'])) {
        return false;
    }

    // Only alter links for the language switcher block
    if ($variables['attributes']['class']['0'] === 'language-switcher-locale-url') {
        global $language;

        // Remove active language from the list
        if (isset($variables['links'][$language->language])) {
            unset($variables['links'][$language->language]);
        }
    }
}

```