All themes from Codefactory47 come translation-ready. Instead of making you create a file containing the human-readable text from a particular theme, we’ve included that file with the theme itself. All that’s left is performing the actual translation, which is where you (or a professional translator) come(s) in.
We’re about to show you how to translate our themes. But first, let’s examine the three types of files
involved in the translation process:
Files that enable translation
Here’s a quick rundown of the three file types and what they contain:
.pot: This file is a “portable object template” that contains all of the text to be translated. Since it’s just a template, it serves as the basis for your translation. It doesn’t contain the translations themselves.
.po: The “portable object” file contains the original text and the translations. It’s the file we’re about to show you how to edit.
.mo: This is the “machine object file.” When your translation is complete, you will convert or export your .po file to this file type so that WordPress can use it.
Now let’s go over how to translate one of our WordPress themes to another language. Using Make as an example, we’ll show you how to translate the theme to Spanish – Peruvian Spanish, to be precise!
Translating our themes
Every theme from Codefactory47 comes with a
.pot file. If you’re not translating one of our themes and you need to
.pot file for a different theme, refer to this primer in the WordPress Codex. Let’s get started
by downloading a free translations editor.
1. Download and open Poedit¶
There are several translations editors out there, some of which we’ll consider toward the end of this article. Poedit has been around for several years and is a favorite among developers and translators in the WordPress community. It’s also free to use, which eliminates a major barrier to entry for first-time translators.
Go ahead and download Poedit now. When the download completes, unzip the file and open the application. You will see this screen:
2. Open your theme’s .pot file in Poedit¶
Click the “Create new translation” option in Poedit and browse your hard drive for a
local copy of the
.pot file for your theme.
You should be able to find it in the folder titled “languages” within the theme folder.
If you didn’t save a local copy of your theme, don’t worry! You can download it from the members’ area of our site.
3. Select a language¶
Poedit saves your translation according to the language and an associated country (for localization). Just begin typing the language and Poedit will fill it in for you. After you’ve entered the language, open a set of parentheses and enter the name of the country.
.po file will be titled according to abbreviations for the language and associated country.
In our case, we’re using Peruvian Spanish, so our file will be
es_PE.po. A Uruguayan Spanish translation would
es_UY.po, and a Vietnamese translation would end up being
vi_VN.po. Makes sense, right?
Poedit creates these extensions automatically, but here’s a lengthy list of country and language codes if you’re interested.
4. Perform the translations¶
Here’s where your language skills come in! Go through every line of human-readable text in your theme and translate
it to the target language. Remember, the
.pot file has already compiled everything you need to translate.
That’s how those lines of text got there.
Just highlight each line, one by one, and enter the translation in the box in the bottom left corner of the Poedit interface.
5. Save translations in .po and .mo form¶
When you save your new
.po file from Poedit, the application automatically generates an additional
and saves it in the same directory on your hard drive.
After saving the files to your hard drive, add a the
webelieve prefix to them, so for example
After renaming the files, use an FTP client to upload both files to the
wp-content/languages/themes/ folder in your
theme’s directory. Now you just have to tell WordPress to use the translation you created!
After translation url parts, the WordPress permalink cache should be dropped. The simplest way is to go to Settings > Permalinks select Post name and click on Save.
If translation doesn’t work, make sure that file names have
webelieve prefix and are placed in correct directory:
wp-content/languages/themes/ and not in wp-content/themes/languages/.