In this post you will learn how to localize and translate Elegant Themes into various languages. Elegant Themes provides three languages, English, German and Russian, but you can translate your theme into the language of your choice using Poedit software.
(IMPORTANT UPDATE: Since February 2015 Divi theme is already translated into 32 languages and can also be translated into other languages without using po and mo files)
In this post I’ll explain how to translate Elegant Themes into Spanish, however the process is the same for all languages.
1. Setting up WordPress Site Language
Since WordPress 4.1 you can change easily the language of your website from the WordPress dashboard. You don’t need to modify WPLANG in wp-config.php file. All you have to do is go to Settings> General> Site Language, and select your language (o install a new language).
2. Elegant Themes language files
There are WordPress core language files (see paragraph 1) and theme language files:
- WordPress core language files. WordPress is presented in English, but you can install it in more than 80 different languages.
- Elegant Theme language files. Elegant Themes only provides three languages: English, German and Russian. So if you need to translate your theme to another language, you can do it using po and mo files and Poedit sotware.
First it is important to download the most current version of your theme. If you look in the main theme structure, you will find a folder called “lang” with six files:
- en_US.po / en_US.mo (English version)
- de_DE.po / de_DE.mo (German version)
- ru_RU.po / ru_RU.mo (Russian version)
As I said before, the .po file includes the original texts and the translations of your theme in two columns. It’s a translation that someone else started (a professional translator, the author, etc), and maybe completed. WordPress doesn’t use it.
The .MO file includes the exact same contents as PO file. The two files differ in their format. While a PO file is easy for humans to read, MO files are compiled and are easy for computers to read. WordPress gets translations from .MO files.
The .MO file is automatically created by Poedit whenever you save a PO file. All you can do with these files is to upload or re-upload them whenever you create or update a .PO file.
3. Translating Elegant Themes into Spanish with Poedit
I will show you how to create your own translations using a program called Poedit. Keep in mind that Poedit is a very powerful tool with many options so I am going to cover the basics.
Poedit is a software (available for Mac, Windows and Linux) which you can use to translate your theme. It’s available for free on poedit.net. Free version comes with a builtin translation memory that remembers your past translations and uses them to make suggestions for similar texts.
Here are the steps to translate the theme into Spanish (or any other language):
- Open Poedit and select File > New Catalog from POT / PO file
- Select en_US po file from your theme (you can find the file in the wp-content/themes/divi/lang/ folder).
- A box will pop up asking for language of translation. Select Spanish- Spain (Español – España)
- Hit OK and Poedit will name automatically your file. If you select Spanish (Spain): es_ES.po
NOTE: You might think that the country code specification can be redundant. But some languages have dialects or variants in different countries. Example: es_MX (Spanish in Mexico). The country code serves to distinguish the variants.
- Save your file in your computer
- Now you can start translating your theme or your plugin. The space at the top will display all the text ready to translate, and any completed translations will display to the right. The boxes underneath show the source text, your translation and any notes for translators. Translating is really easy – just select a word or phrase, enter your translation and click “Validate”.
- You have to respect all special characters from the original text (look at the screen capture)
- It´s not necessary translate all text strings. Perhaps you don´t want to translate text strings in the admin theme.
- When you’ve finished, save your file. Poedit will automatically create both .po and .mo files. You´ll have to upload both to your theme’s languages folder. I use Filezilla to upload the files to my server.
Thanks for sharing!!!