Embedding translatable strings in the template
From Joomla! Documentation
In the template itself, translations are handled using the JText static class. It is referred to as "static" because it does not require instantiation as an object before its methods may be used.
Simple Text Strings
Most text strings can be translated using the "_" (underscore) method. For example, suppose your template contains the English text "Welcome" which needs to be made translatable.
<?php
echo 'Welcome';
?>
Then you would replace the static string like this:
<?php
echo JText::_( 'Welcome' );
?>
This would cause the translation system to search the appropriate language file for "WELCOME" on the left side of an equals sign. The search is case-insensitive. If this language definition string is encountered:
WELCOME=Welcome!
the effect will be to output the string "Welcome!" to the browser. If the user switches to the German language, the German language definition file will be searched for "WELCOME" and this time might encounter the string:
WELCOME=Willkommen
and so "Willkommen" will be sent to the browser. Importantly, if the user switches to German but there is no German language file present, or the appropriate string does not appear in the German language file, Joomla will fall back to sending the untranslated string "Welcome" to the browser, also preserving its original case.