Translating WordPress themes

There are a few things to take into account:

1. Gettext the strings:
WordPress uses an opensource solution called GetText, that has a php version included with the WordPress package

For example:

<?php printf( __( 'View all posts by %s ', 'twentyeleven' ), get_the_author() ); ?>

A complete guide can be found here: http://urbangiraffe.com/articles/translating-wordpress-themes-and-plugins/

2. Generating the .po file

Name it like the language you are using. For example, Spanish from Spain is es_ES.po. Put all the strings there. Following the example

#: content.php:57
msgid "View all posts by %s "
msgstr "Ver todas las entradas por %s "

3. Put the .mo file into the /languages directory of your theme

Following the example, es_ES.mo

Like in many other occasions, the best thing may be to follow an example. So, the guys at WordPress with the help of the community have translated the included themes such as TwentyTwelve here:

http://translate.wordpress.org/projects/wp/3.5.x/twentytwelve/es/default

Thanks to Roger for this post in StackOverflow: http://stackoverflow.com/questions/7105556/wordpress-theme-and-language-pack