Adding Language Support using .pot and .mo files to a WordPress Theme?

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

Leave a Comment

tech