How to Translate a WordPress Theme Using Poedit
Most WordPress themes come in English by default, which can be challenging for non-English speakers. This guide will help you translate your theme into any language.
What Does Translating a WordPress Theme Actually Mean?
When you think of “translating a WordPress theme,” it might sound like simply converting everything on your site into another language. However, whether you’re a theme developer or a theme user, it can mean two different things:
If you’re a theme developer, translating the theme’s interface involves converting all the strings that users see on the backend, like buttons, settings, and notifications. These strings come with the theme itself, separate from the custom content users add to their sites. You translate these strings through resource files called .pot, .po and .mo, which WordPress uses by default.
For theme users, translating WordPress content involves any custom text they create, like blog posts, pages, or custom post types. For example, a user who creates testimonials with your theme might want to translate them too to reach audiences in multiple languages. WPML, a leading WordPress translation plugin, is designed for such tasks. It offers features like automatic translation powered by WPML AI, which combines ChatGPT with WPML’s WordPress-optimized algorithms. This makes translating content quick and easy.
In this guide, we’ll focus on translating your theme’s interface and ensuring that all built-in, user-facing strings appear translated and ready for a multilingual audience.
Solutions for Translating Your WordPress Theme
You’ll find various solutions for translating a WordPress theme, from basic text editors to specialized software tools that simplify the process.
Two popular tools include Poedit and PTC.
The free version of Poedit uses a manual approach, letting you edit .po files directly to translate each string within your theme’s interface manually.
PTC, a software translation tool by the makers of WPML, offers an automated approach that greatly speeds up the translation process. By translating .po and .mo files automatically, PTC eliminates the back-and-forth between developers and translators, making it much faster to get quality translations for your theme or plugin.
To try PTC, upload a .pot or .po file to the Free resource files translation tool, choose your target languages, and receive translated .po and .mo files ready for use within minutes. Of course, you can edit the translations too, if you see the need.
Below, we’ll walk you through the steps to use Poedit for translating your theme’s .po files manually.
Step-by-Step Guide for Translating WordPress Themes Using Poedit
To begin this WordPress guide to translating a theme using Poedit, you’ll need the following:
- Poedit software installed on your computer. You can download Poedit for OS X and Windows.
- WordPress theme files on your computer.
Step 1 — Opening Your Theme’s Default Language Template
Start by opening Poedit and selecting to Create new translation:
A new window will pop up. Select the WordPress theme you want to translate. A theme’s default translation template is located in THEMEXXX/lang/YYY.po, where THEMEXXX is the name of your theme and YYY – default language of the theme (twentysixteen/lang/en_EN.po in this example):
Next, from the dropdown menu, select a language you want to translate your theme to. In the example below, we’ll choose Lithuanian:
You are ready to translate your theme now.
Step 2 — Translating Your Theme
To start translating, highlight any string you want to translate:
Then, in the Translation section, manually enter your desired translation for the source string:
Once you have translated all the strings in your theme, save the file (lt_LT in this example) in the same directory as the original template:
Step 3 — Changing Your WordPress Website Language
Now, you need to configure WordPress to display the translated content you created with Poedit.
Upload the .po file you saved in step 2 (lt_LT.po in this example) and .mo file (lt_LT.mo was generated automatically by Poedit) to the corresponding directory on your hosting account.
The directory should look similar to public_html/wp-content/themes/THEMEXXX/lang, where THEMEXXX is the name of your WordPress theme. If you need more guidance, check out how to upload files to your website.
Open the wp-config.php file (located in your WordPress installation) and add the following line:
define (‘WPLANG’, ‘ZZZ’);In this case, ZZZ is the name of the file you used to save your translation (lt_LT in this example):
Now, when a user configures WordPress to use the translated language, they’ll see the theme interface in that language.
Conclusion
Translating your WordPress theme lets people use it in their preferred language. In this guide, we covered the difference between translating a theme’s interface and user-generated content. We also showed you how to manually translate a theme using Poedit and introduced PTC for a faster, automated approach that simplifies .po and .mo file translations.
Whether you use Poedit or PTC, translation opens your theme to new audiences around the world.
Comments
August 02 2017
please help me !! it's work good with same terms but other terms can't be translated i ont know why !
May 08 2022
Hey, Thanks for your hint. I have a question thou. Will the future theme update not going to delete these added translated .mo and .po files from the folder: wp-content->theme->theme-name->languages? Would appreciate your answer. Cheers!
May 12 2022
Hi! As default theme files generally do not include .po and .mo files, they should not be deleted. However, as a precaution, I would recommend saving them before updating the theme :)