How to translate WordPress theme

This article explains how translators can go about localizing your WordPress theme to local languages.

Prerequisites

translation-ready, that’s means theme support multi language but you translate manually.

Tools

Install Poedit tool. click here to download.

Or other tools, see Translating Tools.

Step by step

Running the Poedit, click the “File” word on the top of menu, then click “New from POT/PO file“. POT file usually place at folder: “theme name/languages“.

20140501100134

201405011001342-1024x558

Then select a language of translation:

20140501101259-1024x558

So you can translate manually.

201405011001341

Click “save” when you translated completely.

201405011001343

You must type a correct name and save, it’s important,see below.

201405011001344

The example is translated to Chinese, so file name is : “zh_CN.po“. You can see Poedit will create “zh_CN.mo” file automatically.

The naming of PO file

The naming of your PO file  is very important and must match the desired locale. The naming convention is:

language_COUNTRY.po

Or, for non-standard encoded localizations:

language_COUNTRY.ENCODING.po

A list of language codes can be found here, and country codes can be found here. A full list of encoding names can also be found at IANA.

Update translation

You should click “Catalog“, then click “Update from POT file” when the theme update.

.pot/.po/.mo file Difference:

.pot: a basic translate template file.

.po: a readable translate file for user.

.mo: created automatically by Poedit, it is for computer to read. Your web server will use the MO file to display the translations.

Notice

WordPress can automatically match language after you have translated.

For instance: Your theme will display Chinese in Chinese language WordPress. But display English only if in English language WordPress.

Leave a Reply