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

2 Answers 2


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


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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