Translation with POEdit – Internationalize / Localize WP Themes Guide – Part 3

Now that you made your theme translatable, let’s do the necessary to translate it.

For that you will have to use a translation software, in this guide we’ll use POEdit, so go ahead and download then install it.

We will use POEdit to create a PO (Portable Object) file which will contain all the translatable words & phrases and optionally their translation for a specific language. If you add a translation to the PO file, you can setup POEdit to create a MO (Machine Object) file, which is the machine-readable file (the one we need to upload to the server with the theme).

Note: PO files have .po extension & MO files have .mo as extension.

In this guide we will create the MO file in one go with the PO file for a specific language:

Launch POEdit & before anything else make sure it will automatically save a MO file every time we make or modify & save a PO file: Go to File > Preferences…, in the Preferences box choose the Editor tab, under Behavior see if “Automatically compile .mo file on save” is checked, check it if not.

Now let’s start making the PO file, go on File > New Catalog…

A box will pop-up with 3 tabs:

The first one (Project info) is for general information, enter utf-8 for “Source code charset” & you may want to give your project a name (theme’s name maybe). Fill the other fields if you wish …

The second tab Paths is to give POEdit the path of your theme’s directory (on your hard drive), bad thing is that you can’t just click on browse & find the directory of your theme. To get the path, use Windows Explorer, browse till you enter your theme’s folder then copy the path from the Address Bar, the path may look a bit like this:

C:\Documents and Settings\Something\Desktop\theme-directory

Click the “New item” button (graphic icon of a little square & star), a field will be created, paste in your path & hit Enter.

Go to the third tab named Keywords, there you tell POEdit about the two GetText functions “_e” & “__”. Click the “New item” button, a field will be created, type in “_e” (without the quotes), press Enter then click again on “New item” & type “__” (2 underscores without the quotes). Hit Enter again then click on OK. You’ll be asked to give your catalog (PO file) a name, since we’ll use it for a specific language, use the two letters ISO Code of that language, for example “ar” for Arabic or “fr” for French (without the quotes). A long list of ISO codes here on Wikipedia. Once the name given click on OK.

Note: POEdit will create a MO file named just like your PO file (ar.po & for example).

If you did everything correctly, POEdit should start scanning the theme’s files then show you a box with the results, click on OK.

In POEdit now you can see three rows:

The first one has two columns, one for original strings, the ones in the theme’s files that you wrapped in the second step, the second column is for translation, would be empty still. In this first row you can click & select the strings you want to translate (or change translation later).

The second row shows the original string selected in the 1st row (not editable).

The 3rd row is where you will enter the translation for the string selected.

You know what to do now, make your translation for each string then when finished save your catalog (File > Save or Ctrl+S).

What if for some reason you decided later to modify the strings to translate, create new strings or delete strings? (by editing the PHP files of the theme)

After you edit the files, POEdit allows you to update the translatable strings: Open your PO file then go to Catalog > Update from sources, POEdit will scan the files again & pop-up a box with a list of “New strings” & a list of “Obsolete strings” (the one that you may have removed), you click on OK to update the catalog.

OK, now rest to upload the theme to the server with the MO file included in the directory. Make sure you use WordPress translated to the same language, most likely you will find it in the WordPress in Your Language page.

Comments ( 13 )

  • I’ve followed these posts and others I’ve found on the subject but always run into an issue of WordPress not rendering or finding my MO file. I do not no where to put the MO file so the load_theme_textdomain() can find it? Can you outline the directory structure of wordpress, your theme and where the MO will go in each?

  • Hi, damn sorry for the late reply, being too busy,

    For the WP core MO should be here:

    / public_html / your-site-folder / wp-content / languages /

    You have to create that languages folder

    Actually for some reason the is working for me but not, didn’t have time to try to solve that

    For the MO of the theme, should be in the theme’s directory:

    / public_html / your-site-folder / wp-content / themes / your-theme /

    I’m using the Language Switch plugin & all languages work fine there.

  • Pingback: Bookmarks about Translate
  • Pingback: Let Me Go @ High Speeds « Alexander’s Blog - The Making of LetMeGo
  • Hi!

    Nice tutorial and also very clear.

    I have followed the steps from the first to the end but I can’t see the theme translated. I don’t know where to start searching for some error.

    Any ideas?


  • it seems that it has something to be with the fact that I am using multiuser version.

    Anybody has any idea?

  • A good tutotial
    But like Jason says, I as well often find WordPress not rendering or finding my MO file.

  • @Jason Darrow
    You will need to edit the wp-config.php file to define the WP_LANG constant for the language you want wordpress to use, apart from having the language files as MuMu said.

    Try renaming to and see if that works.


  • Pingback: Tutorial para criar seu tema com internacionalização | joaobarroca.Net
  • Your defining work of localization and internalization really sets me up on the work.

    Great guide.

  • Pingback: Tweets that mention Translation with POEdit – Internationalize / Localize WP Themes Guide – Part 3 | Gettin' Geek --
  • Pingback: Let Me Go @ High Speeds

Comments are closed.