I worked out this approach:
- Choose a “domain”. This is a kind of namespace for your translation. It can be the name of the template. For my example the domain name was: andreas09
- Inside the templates you want to translate, replace every text with the function
_e('text','domainname')and__('text','domainname')respectively using the original text as a parameter.Example:
<h2>Not Found</h2>
will become
<h2><?php _e('Not Found','andreas09');?></h2>Whether you need to use
_e()or__()depends on the way the text is used. As a rule of thumb: If the text is used as a parameter inside a function, then translate with__(). Otherwise use_e().
Detailed information can be found here
- When you have prepared all the template files, you can build the .mo and .po files. I did this with the editor poedit and this manual (in german) located at the german wordpress.de site. More information in English can be found on the website.
A short summary:
- install poedit
- adjust the settings
- create a new catalog
- catalog options:
- basepath: absolute path to the theme directory on the harddisk
- paths:
.(only the dot)
- Save as “de_DE” to the theme directory. de_DE for a German textfile. Otherwise the code for the intended language.
- update catalog if needed
- translate all texts
- save
- Inside one file of the theme which is included everytime (e.g. index.php or header.php) the function
<?php load_theme_textdomain('andreas09');?>must be inserted. Again, use your choosen domain as a parameter.
From now on, every piece of text should be displayed in the new language.












Thank you for this great tutorial. Only one question is still unanswered for me: If i do a translation / localization and then change line numbers by modifying the code, does this have any impact on the translated output?
No this has no impact on the output.
If you change the templates an leave all _e() and __() functions unchanged, then everything sould be fine.
The identifiers for the translation are the texts within the _e() & __() functions. So if you change _e(‘Not Found’) to _e(‘Nothing Found’) the translation will not be working any more for this particular text.
Hi! Can I ask a newbie question?!
I did not know about the proper ways of translating themes and I simply translated the php files.
Now that I saw .pot files I am a bit confused.
Can I simply translate text in the pot file?? WHat else do I need to do?? Cuz I did, and I don’t see any change. How should I implement the translated pot file??
Hi Milad,
I think your questions are already answered in my article above.
You can’t just translate the pot file. You need the .pot file and translate it with some editor like poEdit. Then you can create the .mo file. This file will be dropped in your theme directory. If the language settings are right, your theme should now be translated.
Make sure that you read all three pages (Seiten) of my tutorial.
Thanks for the nice tutorial. I intend to translate theme vidiyal (http://themecorp.com/themes/vidiyal/), which is already quite ready for translation (ie, with lines like
< ?php edit_post_link(__('Edit This)')); ?>
But as you can see, there is no domain in this case, neither is there a call to load_theme_textdomain(), so how am I supposed to do?
Another point: http://www.poedit.org/ seems kind of down, but http://www.poedit.net/ is OK.
Hi Mll,
I think the vidiyal theme uses the default wordpress strings, so if there is the “official” string of “Edit This < br / >” it should be translated inside the theme too.
So if you use a localized version of wordpress, the theme should show translated strings. If it doesn’t, I advise you to change all _e() and __() functions and add a domain to the function call.
Therefore you can create your own translation an make sure the strings are translated as you want them to be.
Thanks for the updated poedit link. I changed it in my post.
I am myself surprised how few templates are multilanguage ready.
Using Gengo plug-in (multi-language plugin) and with your tutorial, i was able to make an (almost) perfect translation of the template blog.txt (aka blogtxt) and display in two languages!
thx for the tutorial.
Thank you for your feedback Kim.
It’s always good to know that my posts are helpful to others.
Hallo! Any idea why my php template files do not show up in the poEdit “update from source” menu? I’m growing rather desperate… after tagging all the _e and __ , there must be something I’ve done wrong. I’ll be grateful for any help.
Hi Paola,
did you set all your paths correct? As my poEdit shows all menu entries in german language, the following might be not perfectly correct:
In the menu dialog
Catalog / Options / Paths
The base path must be the directory of your theme/templates.
The list of paths below must contain “.” (a single dot).
Hopefully this will solve your problem.
I have uploaded both Mocha and Gengo into my wp plugin folder, but when I have activated them in the wp-admin plugin page they have “disappeared” from the list, also if they are still present in the folder.
I have deleted them from the folder and uploaded again, but nothing happens.
Some suggestions?
Thanks
Hi Lorenzo,
what is Mocha and Gengo?
Dear Tim,
I am using the Blue Zinfandel theme in my WordPress weblog. I would like to ask you to check it if it is possible to translate it into Hungarian the way you have described above.
Thanks!
Laci
Hi Laci,
I had a quick look at the Blue Zinfandel theme. As it seems to be a standard wordpress theme, I think it should be possible to localize the theme without problems.
In fact, it should be possible to localize any wordpress theme, as the method to do this is based on standard techniques used by wordpress itself.
Tim
Thanks a lot!!!

It was about 4 hours I was searching for a solution!
It now works very well.
I’m webdesigner and was a newb about translations in Wordpress.
I edited the french Wordpress version (2.6.1) and based my theme on kubrick’s french version
which had .pot, .po and .mo files in the folder.
I first copied the folder and modified all the files and codes to fit my design
but couldn’t understand why the po and mo files wouldn’t work even after renaming it… hehe
Now i understand that the path is inside the file and the the .po is just a source file to generate the .mo as you save. (the .pot a kind of structure that was useless for me as i had already the almost correct translation in the .po)
So if someone read this comment and just need to make his own theme based on an existing theme with .po and .mo files (which is quite faster to release) you just need to use a .po file editor and change the path as it is explained in the tutorial (i also changed the name of the file as “fr_FR” and change the “domain” in my php files).
For mac users you can get the path of your folder by “CMD+i” it
(you can’t copy-paste it but it doesn’t take that much time to write…)
Thanks again.
Thank you for this great tutorial. You solved the problem in no time! Excelent! Now all my new themes will use this method, so anyone will be able to translate it easly.
Thanks again!!!! Very very very much!!!
I am having trouble localizing Carrington Mobile. That is: a plugin and a theme. I managed to translate Carrington Mobile theme and plugin. At least almost. There are still some words here and there which didn’t appear on the poEdit.
For example:
“about”, “more →”, “Return to the Mobile Edition”, “Categories: Uncategorized”
are still untranslated. Any suggestions?
It appears there are two project names: “carrington” and “carrington-mobile”. So, I should make two sets of .po and .mo files. Am I missing something? Where should I put the different files or should I somehow merge them? And how is this possible?
http://wordpress.org/extend/plugins/wordpress-mobile-edition/
http://wordpress.org/extend/themes/carrington-mobile
sorry i am a newbie, i have mimbo pro 2, which allready been translated as far as i have understood to many languges (as i can see language files in the .po and the .mo files for Dutch language, but what is next?
i have tried putting the nl_NL.mo as well as the nl_NL.po
in the theme drictory but nothing changed
i also have inserted
intio the header, but no luck
am i missing any thing here?
regards
Has anybody had any success localizing the Mimbo Theme using this method? I have tried to localize it to spanish (es_ES) following all the steps with no success…
Just wanted to say thanks for your article. I got everything right except the domain part… But now I know how it works!
Cheers