Rural Blog docsAll pages

.po and .mo files

The three file types

.pot The template. A list of every translatable string, no translations. Ships with the theme
.po Your translation, human-readable. What you edit
.mo The compiled version. What WordPress actually reads

The theme’s template is at wp-content/themes/rural-blog/languages/rural-blog.pot.

With Poedit

  1. Download Poedit (free; poedit.net).
  2. File → New from POT/PO file, choose rural-blog.pot.
  3. Pick your language when asked.
  4. Translate. The list shows each source string; type the translation underneath.
  5. File → Save as, named for your locale — de_DE.po. Poedit writes the matching de_DE.mo beside it automatically.

Find your locale code in the WordPress translate.wordpress.org locale list, or just read it off Settings → General → Site Language — it is what appears in the WPLANG option.

Where to put the files

Not in the theme folder. Files there are deleted by the next theme update.

Put them in WordPress’s own language directory:

wp-content/languages/themes/rural-blog-de_DE.mo
wp-content/languages/themes/rural-blog-de_DE.po

Note the naming: rural-blog- + locale, with the theme’s text domain as the prefix. That folder survives updates of WordPress, the theme and everything else.

Placeholders

Some strings contain %s, %d or %1$s. They are replaced at runtime with a name, a number or a link.

Context and comments

Strings with a translator comment — Poedit shows them in the sidebar — carry information you need. /* translators: %s: Author name. */ tells you what is going into the placeholder.

A few strings have a context (they appear twice with different meanings, like Password as a label and Enter as a button). Poedit keeps them separate; treat them as separate strings.

Testing

  1. Set Settings → General → Site Language to your locale.
  2. Upload the .mo to wp-content/languages/themes/.
  3. Reload the front end.

Nothing changed? Check the filename exactly — rural-blog-de_DE.mo, hyphen between the domain and the locale, underscore inside the locale — and that you uploaded the .mo, not only the .po.

Sharing it

If you have translated the theme into a language others use, please contribute it at translate.wordpress.org. Everyone in that locale then gets it automatically, with no files at all.