How to translate a WordPress theme with Poedit?

3 Min Read

The WordPress themes developed by Themeum are translation ready, that means you can build a site in any language with our themes. The default language of our themes is English. So if you want to launch a website with Spanish contents, say, you need to translate the theme texts into Spanish language for a better user experience.

A theme comes with many texts, system feedback, prompts etc. For example, each blog post followed by a bunch of texts “previous article” and “next article”, “ Comment” etc. These strings are given inside the theme itself. So you should translate these texts to the Spanish language for a fully localized site.

Step 1: Set WordPress Language and Install Poedit

Launching a WP website in any specific language involves three major steps- Getting the language in the CMS, translating theme specific texts and finally adding contents in that language. Firstly, you need to install that specific language in your WordPress site. There are two ways to get it done. If your site already up and running (in English language), visit the WP Dashboard > Settings > General. Scroll down. You will get a drop-down menu to select another language. Select your preferred language and save changes. This will install and activate your desired language (say Espanol- Spanish) on your site.

settings-wp-language

This action will just show your preferred language for only the texts which are directly from WordPress core. You can also install WordPress in a specific language (if available) while setting up the site first time.

Once you install your preferred language in your WordPress setup, the next thing you need is to translate your theme. We will do it with Poedit software. So download and install Poedit on your computer to start the process.

Step 2: Edit Theme Language Files

In this experiment, I’ll show you how to translate the English word “Comment” to Spanish which is shown inside the comment box on a single post page.

comment-text-en22

You need to edit the theme language (.po) file for a specific language. There is a folder called “Languages” inside the theme folder you’ve downloaded. For an example, if you’ve downloaded the Eventum theme provided by Themeum, you will get a zipped file. Unzip the compressed folder after downloading it.

Now you will get a folder called something like “themeum_wp_eventum_themeforest_bundle”. Enter into this folder. You will see the following contents.

themeum_wp_eventum_themeforest_bundle 2016-01-26 10.52.35

Navigate to theme-pack > eventum > languages.

languages 2016-01-26 11.03.54

There are language files with .po and .mo extensions. Two files for each language. We need to edit .po files to translate the theme. The .mo file is not for human editing- it’s more of machine (system) side stuff. When you edit the PO file with Poedit, the MO file automatically gets some adjustments. So we will need the both while uploading to the main server.

In our example, the two files for Spanish language are es_ES.po and es_ES.mo. Open the es_ES.po file with Poedit software. Once you open a PO file with Poedit, it will look like this.

po file in poedit

Let’s add “Comentario”, the Spanish meaning of “Comment” in the translation box on Poedit. (Note: I’ve used Google Translator to translate English to Spanish.)

translation

You can add translations for all the texts displayed by the theme using Poedit. After adding translations, click the Save button and close the Poedit window.

Step 3: Upload PO & MO files on the Site Server

So we’ve just added translations on language files locally. Now these files need to be uploaded to the live site server in order to implement the translation. You need to login to your site’s hosting server using an FTP program or cPanel. Navigate public_html or www directory. Go to wp-content\themes\eventum\languages. Upload and replace the pair of language files there. Since we’re dealing with Spanish (Espanol) language, upload those edited (es_ES.po and es_ES.mo) files to the server (path: wp-content\themes\eventum\languages). You will be required to replace the existing files (on the server) with locally edited files in this instance. Once this is complete, just refresh the post page where the comment box is shown. You will see the Spanish translation this time.

comment-translated222

That’s it. I’ve used the Poedit 1.8.6 (4129) version and WordPress 4.4.1 in this tutorial. Hopefully, it will save your time and help you much in localizing our WordPress themes. If you need to translate to a language for which there is no PO/MO file in the theme package, just contact us and we will provide you with the respective language files. Thank you for being with Themeum.