WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do we add language support using .pot and .mo files in a WordPress theme? And how we retrieve the theme?

share|improve this question
up vote 7 down vote accepted

The .po (Portable Object) file is like a small library containing all the English terms in the theme with an empty column for non-English translations. Using software like Poedit, the .po file can be opened, translations can be added, and it can be saved, which also generates the .mo (Machine Object) file.

With a suitably localized theme, the steps involved in translating it are:

  1. Run a tool over the code to produce a POT file (Portable Object Template), simply a list of all localizable text.

  2. Use a plain text editor or a special localization tool to generate a translation for each piece of text. This produces a PO file (Portable Object). The only difference between a POT and PO file is that the PO file contains translations

  3. Compile the PO file to produce a MO file (Machine Object), which can then be used in the theme or plugin.

Open Source Software Needed for the translation process:

Poedit a cross-platform gettext catalogs (.po files) editor

Gettext the GNU `gettext' utilities are a set of tools that provides a framework to help other GNU packages produce multi-lingual messages.

A complete guide and tutorial on translating WordPress themes can be found on Urban Giraffe

share|improve this answer
Nice answer! – MikeSchinkel Aug 23 '10 at 3:39

My first recommendation would be to read this article in the WordPress Codex.

To add language support, the first thing you need to do is make sure all of your echoed content is passed through a filter that can handle internationalization (i.e _e() and __()). Then you'll need to make sure everything is mapping to the same text domain.

From there, you'll use an external tool to parse all of your content for translatable strings, translate them, and save the appropriate language files. Full instructions and a list of resources are available on the codex article I linked to above.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.