Localize WordPress Theme
by ne-design, May 6th, 2008 in Tutorials, WordPressDid you ever wanted to have the WordPress theme you liked to be in your language? or did you ever wanted to make a theme that is available for translation? In this tutorial I will cover on how to make any WordPress themes to be localized.
You will need to know a little about php to understand this tutorial. Just the basic would be fine.
Step 1 – Choose a domain
This would be the name for your translation. Usually I use the theme name as a domain. In this tutorial I will use my theme “Vanilla Globe” as in example. So the domain would be “vanillaglobe”.
Step 2 – Replace text with function
Inside the themes you will see text like
404 Error: Not Found
change the text into a function like this
<h2><?php _e('404 Error: Not Found','vanillaglobe'); ?></h2>
As you can see you will need to replace the text that you would like to translate with the function
<?php _e('text','domain'); ?>
Step 3 – Add __
Not only text, you would also want to have some parameters within the template tag to be translated. Example would be like
<?php the_content('Read more...'); ?>
add __ and the domain
<?php the_content(__('Read more...','vanillaglobe')); ?>
if there is more then one parameter, sample would be like this
<?php comments_number(__('No Responses','vanillaglobe'), __('One Response','vanillaglobe'), __('% Responses','vanillaglobe'));?>
Step 4 – Include the function
Open the header.php and at the very top include the code below
<?php load_theme_textdomain ('vanillaglobe'); ?>
This code is needed for WordPress to understand to use the language file that is inside the theme folder.
Step 5 – Build .po and .mo
Lastly, build the translation file in your language! You can look here to learn how to translate using poEdit. Make sure you have the files inside wp-content/themes/themename/. The name of the file should be the name of the language.






I recommend a plug-in for Wordpress called Langswitcher http://www.poplarware.com/languageplugin.html
It allows you to create multilingual websites with ease. You can actually write posts in several languages. The user in just a click can read the website in their preferred language.
The only downside is that there is no graphic interface to, for example, write your post in one language in one window and then the same post in a different language in another window, or save the content in different database records. It uses tags. For example, to write Hello World in English and Spanish, you have to write in the same post: [lang_EN]Hello World[/lang_EN][lang_ES]Hola Mundo[/lang_ES]
This is not a big issue if it is your own website, but it can be problematic if you are working with a team of writers and translators.
I actually haven’t had time to work in creation of a code for multilingual posting based on the Langswitcher plug-in. If anyone know of any piece of code that does this, please let me know.
By the way, if want to see the plug-in in action, feel free to visit my website: http://www.CodeSpanish.com
Nice plugin!
I actually have a totally different post for my Japanese websites so it might be little hard to use the plugin for myself. The plugin might be good for my clients. (They have the same information in English and Japanese)
Thank you for your mention Pablo!
Wow, I didn’t heard about that up to the present. Thanks!!
Have you heard of STCFX I noticed that they have a similar theme on that site.