Can I use the $language variable in a Drupal 6 template file?
The variables that are usable in a page template are visible in the source code of template_preprocess_page(). The template file you are referring to has the variable $language, which is a copy of the global $language, where $language-&gt;direction has instead the values "rtl" and "ltr."
The content of $language is an object with the following properties:


'language'
'name'
'native'
'direction'
'enabled'
'plurals'
'formula'
'domain'
'prefix'
'weight'
'javascript'


The line of code you wrote needs to be written as if ($language-&gt;language == 'es').