By default all Templatic themes are in English. If you need them in your own language you’ll have to translate them. This tutorial explains that procedure.

Introduction to PO and MO files:

PO files (Portable Object files) :
PO is the file where translation of both languages are stored. One is English and the other is the one you’re translating to.

MO files (Machine Object files) :
PO files are then converted to machine readable binary files (MO files). The plugin which we’ll be using will do this step for us.

1st method: Using Poedit

Poedit is a free program that enables you to easily translate .po files and generate .mo files. Poedit is available for all major operating systems; you can download it by clicking here

To get started first locate the English .po file included with the theme and download it to your hard drive. It will be located either in the theme root or in the /localization folder.

Once you download the file create a copy of it (copy/paste it in the same folder). After you do that rename that copy into your country .po file. For example: it_IT.po.

Open the .po file you just created with Poedit and start translating it.

Once you finish translating it just hit the save button (or CTRL + S). Poedit should create a .mo file in the same folder where the .po you were editing was located. If you don’t see the .mo file open Poedit and go to File -> Preferences.. -> Editor tab – and make sure “Automatically compile .mo on save” is checked.

When you finally get your .mo file upload it back to the server in the same folder where you found your .po file.

Editing the Code:

Open a theme file called functions.php (theme root) and find this at the beginning of the file
//load_textdomain( ‘default’, TEMPLATEPATH.’/en_US.mo’ );change it to
load_textdomain( ‘default’, TEMPLATEPATH.’/it_IT.mo’ );

Note: What we did was just un-comment that line of code (removed //) and entered our .mo file.Note2: If you put your file in the /localization (or some other) folder you need to edit the line accordingly. Example: load_textdomain( ‘default’, TEMPLATEPATH.’/localization/it_IT.mo’ );Note3: Certain themes will have ‘templatic’ instead of ‘default’ on that line. Do not change that part, just make the change as described above

2nd method: Using CodeStyling Localization plugin

If you don’t want to use Poedit for this you can do this directly from WordPress using CodeStyling Localization. A warning though, this way is significantly slower.

You can use a FTP client, like FireFTP, to upload this plugin or use File Manager from cPanel

Now login to WordPress admin and from the plugins section, activate CodeStyling Localization.

From the Tools, click on “Localization”. After that click on the Themes tab and then on the “Add New Language”. After the popup appears just select your language.

After selecting the language, click on “create po-file“.

Scanning for possible language translation words:

In the next step click on “Rescan“.

Now click on “Scan now” and then on “finished“.

Generating MO file:

From the WordPress admin, go to Tools > Localization. Click on “Edit“.

In the next screen, notice the “generate mo-file” button. Click on this button.

If you’re unable to generate a mo file please do the following:

Download the po file to your desktop and open it with Notepad++ or a similar text editor.

Go to the (toolbar) Search -> Replace (or hit CTRL + F on your keyboard). In Find what field enter #@ default and in the “Replace with” box enter #@ name_of_your_theme (or just about anything except default – NO spaces)

Hit “Replace All” and then save the changes

Upload/overwrite the file back to your server

Open the plugin and ry to generate .mo file again. Under textdomain select the textdomain you just created

Editing the Code:

Now open functions.php of your theme (theme root) and find this at the beginning of the file//load_textdomain( ‘default’, TEMPLATEPATH.’/en_US.mo’ );
and change it toload_textdomain( ‘default’, TEMPLATEPATH.’/it_IT.mo’ );

That’s it. If you have any issues with translating your theme just create a thread in the forums and we’ll help you out.

Newsletter Signup

25 Comments

Thanks for the tutorial. I’m using wp store and followed the steps, everything works until I got to edit section. In textdomain I don’t see ptthemes, instead it’s written default and I don’t see a generate mo-file. Am I doing something wrong?

I cannot generate a mo file. The textdomain is “default”, instead of the ptthemes-breadcrumbs on the image. Also if I rescan the original english file, I lose the ability to generate mo files. What do I need to change?

I do. This is part of the po file. The line with #@ ptthemes_breadcrumbs tells the plugin which text-domain the translation is. When you re-scan the po file, the plugin strips that line, and only #@ will remain. So you’ll manually have to search and replace that line to restore that. Once that’s done, you can generate a mo file.

Hi everybody,
Thanks to the extensive explanations by the Templatic team and your helpful comments, I managed to accomplish pretty much every step of the tutorial. However I’m having a problem with the final step.
—
From WordPress admin Appearance tab, click on “Editor“. Now click on “Functions.php” Locate this line
24 /*load_textdomain( ‘default’, TEMPLATEPATH.’/en_US.mo’ );*/
—
I cant find such a line in functions.php or any other file for that matter. I scanned for “en_US” in all the .php files but I didn’t find anything of any importance. So I added the line
—
load_textdomain( ‘default’, TEMPLATEPATH.’/bg_BG.mo’ );
—
just before the section ADMINISTRATION FILES in functions.php. But nothing changed.
I should mention I’m working on a WP store theme bought and downloaded last week.
Any suggestions? Am I missing something? Thank you!

In my wordpress installation, with copy-paste, I got the wrong kind of apostrophe so nothing worked. And sometimes we tend to look at all weird and complicated places for the bug, but it’s there before our eyes and we cannot see the different symbol!
Hope that helps to all confused who did everything right but see no translation…

Hey, Lisa, thank you (: The problem was exactly what you described. I figured it out soon after I commented. Thank you for answering!
I now have another problem. I add an another language but when I click on “Rescan” to scan the po file (following the tutorial again) it doesn’t work – the progress bar appears but it doesn’t do anything. I’m not sure what I did wrong to mess this up but if I figure it out I’ll share my findings.
Thank you again!