How to Translate a WordPress Theme
If you are familiar with WordPress and the many plugins and themes available for it, you’ve probably come across some strangely named files like .mo, .po, and .pot. If you haven’t then the theme and/or plugin has not been designed for translation. This article explains how to take a .po file that is included with your WordPress theme and/or plugin download and translate it into your native language.
So what the heck are those .mo, .po, and .pot files anyhow and why are they included in my download?
Well, the files aren’t really important if English is your primary language but if you want to have WordPress, a WordPress theme, or even a plugin localized in your native language then those files are golden.
- .mo stands for Machine Object
- .po stands for Portable Object
- .pot stands for Portable Object Template
The file that you want is ideally a .po file since it’s the raw editable text scraped from the entire WordPress theme/plugin. The .mo file is the compiled export of the .po file which is used by WordPress.
Here are the steps to translate/localize a .po or .pot file into another language
- Download a gettext file editor like poedit and install it.
- Open the English .po file that came with your WordPress theme or plugin with poedit. If you only got a .pot, just rename it to .po and open it in poedit.
- Now go through and translate all the text one line at a time in the bottom box.
- Then “File” => “Save as” to your desktop or a folder on your computer. This will output a .po and .mo file.
As you can see from the screen shot below, the top part of the file contains the entire list of text that needs to be translated. Each line represents a place within the WordPress theme or plugin that stores the text. If you click on different lines, you’ll notice the section below displays that exact line of text. What’s even cooler is if you right click on any line, you’ll see a file name and line number like “comments.php line 121″. That is the exact place in the theme or plugin where this text is being used.
Now here’s where you need to pay attention. The blank box below that is where you will type in your translations. So in the screen shot I translated “Page not found” into Spanish by typing in the correct translation in the box below.
After you start making updates, you’ll notice the upper right portion of the file will begin to fill in. Once you finish the translation (make sure to save often), you will have your final raw file.
Now that you’ve completed your translations, you can plug-in your file and see if it works. The .po file is your editable file which you can always load back up in poedit and update. The important file is the .mo file. This is what WordPress will use and if it’s for a new theme like ClassiPress, it needs to be placed in the /wp-content/themes/classipress directory.
I also forgot to mention that the naming of your .mo files is very important and must match the desired locale otherwise it won’t work. The naming convention is based on the language code (e.g. pt for Portuguese) followed by the country code (e.g. _BR for Brazil). So, the Brazilian Portuguese file would be called pt_BR.mo. See the complete list of language codes and country codes to find your exact locale.
You will also need to make a change to your WordPress wp-config.php file (located in your WP root directory) with the correct language codes like the example below. If you don’t have a WPLANG entry then create one.
define ('WPLANG', 'pt_BR');
Assuming you’ve made all these changes, you should now be able to reload your WordPress theme and see it in your native language! If it’s not working, chances are you didn’t use the correct naming conventions for your .mo file or in your wp-config.php file. If you see part of your site translated you either didn’t translate the entire .po file or the .po file wasn’t completely translated correctly in the first place.
So if you recently purchased ClassiPress and a language pack file (.mo) is not available for your native language, you should follow the steps above and create your own. ClassiPress is designed to work with virtually any language so just take the included .po file and translation away! Make sure to contact me and send over a copy so others can download your language pack. You will get full credit for the work and a link back to your site in return.
Tags: gettext, localize wordpress, poedit, translate wordpress












Jun 16, 2009
Hello, i bought this great theme yesterday, and have the spanish translation ready.
You can check it in my site: http:www.clasificadoanuncio.com
I’m contacting right now to send you the files.
Regards…
Jun 16, 2009
Great…thanks. I’ve just sent you an email with details on how to get listed on the classipress resources page.
Jul 05, 2009
Hola, donde puedo conseguir la tradiccion en español?
Gracias
Jul 05, 2009
Gustavo, escribime a grangonzo1 arroba yahoo.com.ar y te la paso.
Jul 10, 2009
classipress is best wordpress theme. I love it.. Thank s for make this theme.
Jul 26, 2009
hi david! i tryed to translate in italian but it doesn’t work in anyway! i modified wp-config with “pt_IT”, i created 2 files pt_IT that i put in wp-content/languages and the same 2 files (named classipress.po and classipress.mo) in themes/classipress..
where’s the mistake?? i don’t understand
thanks!
spachez
Jul 27, 2009
spachez contact me and i’ll help you alex . azzi (at) gmail
Aug 04, 2009
Hola !
Me gustaria saber si ya hay una traduccion oficial al Español de Classipress y si realmente funciona ¿ donde se puede conseguir ?
Saludos!
Aug 05, 2009
Hello David and all,
I am having a real hard time translating de CalssiPress. I have red all the posts and mixed information about these and i believe i am doing the right steps. What i did was:
1. Downloaded and unziped the pt_PT-2.9.2.zip file from http://wpclassipress.com/resources/
2. With FileZilla i copied the pt_PT.mo file to /wp-content/themes/classipress
3. With FileZilla i went to the wp-config.php file and edited to: define (‘WPLANG’, ‘pt_PT’)
After doing all this, when i try to reload my site i get a blank page with this error message: Fatal error: Call to undefined function wp() in /home4/mercado7/public_html/wp-blog-header.php on line 14
Even if i undo all the steps above, i still get the same blank page and message error. I can only reset all this if i unistall WordPress from my server (BueHost) and start it all over! Just to hapen the same again…
I have also tried to put the pt_PT.po file together with the pt_PT.mo into /wp-content/themes/classipress and also to creat a /wp-content/languages folder and put them both in it.
Can anyone give me some help here? My site is http://www.mercadosurf.com. You can reply directly to my email parenteandre(at)hotmail(dot)com
Thank you very much
André
Aug 16, 2009
How do I make the yellow color for the featured ads a darker shade? My yellow shade is so light it’s almost white…
help please..thanks
Sep 03, 2009
How about time translation in ad list? Is there any suggestions how to make that “8 mins ago” sound in native language?
Sep 07, 2009
This item is translated into the line where it is written (% s ago).
Sep 09, 2009
Is there a way to easily change between multiple languages for the classipress theme. If we have multiple versions of the .mo, .po, .pot, is there someway to change it. I want to keep the posts (classified ads) the same, just change the menu and stuff.
Sep 23, 2009
Realy nice post and i am realy greatful to this post.
Oct 06, 2009
Me gustaria saber si ya hay una traduccion oficial al Español de Classipress y si realmente funciona ¿ donde se puede conseguir ?
Gracias!
Oct 28, 2009
thank you, thank you, thank youuuu !!!!
Nov 26, 2009
Howdy
Great tutorial! I’ve used it already for an website.
But now I’ve got an problem… The theme I use for http://www.dafcoupe.nl GreenyGrass doesn’t have an .po, .pot or .mo file. How do I translate it now?
Greetings!
Nov 30, 2009
If the theme didn’t come with any of the language files then it’s most likely not setup to work in different languages.
Not all themes are built with multi-language support unfortunately.
Dec 14, 2009
Okay, thanx for your replay! Then I’ll change all the words in the theme-editor.
Greetings!
Dec 15, 2009
The ClassiPress has no option of Brazil’s currency the real?
Dec 15, 2009
There will be a new version this Sunday which includes support for five new PayPal supported currencies. Read this post for more details.
Feb 19, 2010
Thanks for this post as I was looking for more information about translating Wordpress themes, and the tools to do so.