04 Jul How To Translate a WordPress Theme (step by step guide)
Many of us are not familiar with English or feel struggled when reading it. There are hundreds and thousands of readers whose native language is different. With over 2 million users on the internet, the need for translating a website is understood and much in demand in the WordPress community. We’ve seen users, who time and time again, forget to translate their website and lose out on thousands of dollars in revenue per year. If only they would translated!
That’s why, today we will be answering the question of “How to translate a WordPress theme”. The tutorial will be beginner friendly and you don’t have to to know in-depth coding or WordPress skills. The only skill required is to follow the tutorial step-by-step and you are done with translation for your website.
Make sure that your theme is translation ready
But, before we start, we need to make sure that your theme is translation ready. Any theme that is not translation ready; needs to be converted into one.
- Recommended read: 6 Best WordPress Translation Plugins
Premium themes are all translation ready, but it depends on the developer itself. Many developers like to skip this part. And there starts your work.
The translation of any WordPress theme is handled by the GNU get text framework. And, if your developer has skipped the part of the translation, you have to make sure that the theme is translated beforehand. Without a translation-ready theme, there is no point in following the rest part of this article.
If you are confused then you can check out the short description on how to make your theme translation ready.
Find the Translation Folder and POT File
Every translation ready theme has a translation folder and you need to find it and access the POT files contained within it.
But, what exactly are POT files? Well, let me describe it below.
- POT files or Portable Object Template files are the main files that take care of translation in a WordPress theme. The file is generated using the __() or __e() function and is generally more. The file is responsible for containing the text required for translation.
- The two more important files are PO(Portable Object) files and MO(Machine Object files). Both of these files are part of the GNU gettext framework.
- The PO files take care of the translation of text in the POT file. After translation, it stores both the English and the translated file contents.
- Finally, the Machine Object file is a machine readable format of the PO file.
Using Poedit to Your Advantage
There are many ways to do the translation, but we will do it using the famous Poedit plugin.
1. The first step is to download the plugin and install it in your WordPress backend.
2. Next, you have to open Poedit and create a new catalog from POT file, by going to File > New Catalog from POT file. Once done, you need to select the POT, which will be located in your theme’s language folder.
3. After selecting the POT file, choose the name of the translation file(will be created). The naming convention is different and you need to be extra careful in naming the translation file.
For example, you are choosing the France language, then you need to choose the name zh_FR.po or tl_PH.po for the Philippines.
To know more about the naming convention, check out the official utilities guide.
Then, you need to save the file in the language folder itself.
4. With the initial files being setup, you need to just translate the theme using the simple interface of Poedit. There is not much in the translation, simple source to destination translation and doing it as much as you can.
There are two boxed. The top box is the source text, whereas the bottom box is the translation box. Type down the translation and click on “update” for it to save all changes.
5. With translation done, install the update theme files to the server.
Enabling the WordPress to Use the Translated Theme
With the translation files in place, more than half of the work is done. So, all you need tell the WordPress ecosystem to use the translation files.
You can update the code in two ways. First going into your hosting File Manager or use an FTP client.
1. Open Up the wp_config.file and add the following line of code.
define ('WPLANG', 'zh_FR');
This above line tells the WordPress ecosystem that French for France is going to be used from now on. To make a change in other language, you just need to change the “zh_FR” with the appropriate code.
The line will tell the WordPress to use the specified language for translation and will override the default values(mostly English). The only thing is that the backend will still be in the English language, you can easily change the backend language through settings.
Over To You
Translating a WordPress theme is easy and can be done successfully with the help of the Poedit plugin. The only thing that you need to take care of is the time it generally takes to translate a WordPress website.
Also, it is always a great idea to take time and do the translation correctly. There is no point in using inappropriate language or translation. The translation should be professional and you should not use colloquial phrases in your translation.
If you are not sure what you are doing, it is better to take the help of a professional and get the job done.
Have anything to add to the story? Comment below and let us know! Also, share the article with your friends.