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?
“Translating a WordPress theme” might sound like converting everything on your site into another language. However, whether you’re a theme developer or a 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’ll 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 a theme might want to translate them 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 makes translating content quick and easy.
In this guide, we’ll focus on translating your theme’s interface. This ensures that all built-in, user-facing strings are translated and ready for a multilingual audience.
Tools 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 of the most popular tools are 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. Meanwhile, PTC offers an automated approach that greatly speeds up translation. By automatically translating .po and .mo files, PTC eliminates the back and forth between developers and translators, making it much faster to get quality translations for your theme.
To use 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 needed.
If you’d rather manually translate your theme, we’ll walk you through the steps of using Poedit.
Step-by-step guide for translating WordPress themes using Poedit
Before translating a theme using Poedit, you’ll need the following:
- The Poedit software downloaded and installed on your computer.
- The WordPress theme files stored on your computer.
1. Open your theme’s default language template
Start by opening Poedit and selecting Create new.
A new window will pop up. Select the WordPress theme you want to translate. For example, Astra’s default translation templated is located in astra/languages/astra.pot.
Next, select a language you want to translate your theme to. In the example below, we’ll choose Lithuanian.
2. Translate 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. You can also use the suggestions on the right sidebar to speed up the process.
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.
3. Change your WordPress website’s language
You need to configure WordPress to display the translated content you created with Poedit.
Upload the .po file you saved (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/languages, where THEMEXXX is the name of your WordPress theme. If you need more guidance on uploading files, 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 :)