How to Translate a WordPress Theme or Plugin (Easiest Method)
Looking for ways to translate your WordPress theme and plugins?
Translating your themes and plugins content is a great way to attract more visitors, build customer loyalty, and boost your conversion rates.
Translation can feel like a daunting task especially if you don’t have any prior experience. But there is nothing to be worried about if you have the right tool to aid you.
In this article, we are going to show you how to translate your theme and plugins using the most user-friendly WordPress translation plugin – TranslatePress.
TranslatePress is a powerful translation plugin that will make translating your website feel like a breeze.
Before we lay down the exact steps you need to take to use TranslatePress, let’s have a look at how themes and plugins are made translation-ready, and also what to do if they are not.
Here we go!
Are Your Theme and Plugins Translation-Ready?
In WordPress, the phrase “translation-ready” implies that a theme or plugin is designed and developed in a way that makes it easy for users to translate its content into different languages.
It does not imply that the theme or plugin has the ability to translate itself. It’s more as if the theme or plugin supports translations and developers or contributors can provide translations for it. It won’t be able to translate itself so you’d still need a third-party tool (like a WordPress multilingual plugin) to fully translate the theme or plugin into different languages.
For a theme or plugin to be translation ready, the following has to be in place:
- Gettext localization function added to the theme or plugin’s code;
- POT file added to the theme or plugin folder.
Not sure what we are talking about? Let’s take a deeper dive into the gettext localization function and POT file to try and understand how they make a theme or plugin translation ready.
What is the Gettext Localization Function
Let’s just say that developers add something called the gettext localization function to their theme or plugin’s code to make the tool translation ready.
For instance, your current theme may have the text string “Read more” displayed on the archive pages of your WordPress website.
![Read more text translation in WordPress](https://colorlib.com/wp/wp-content/uploads/sites/2/image-53-20230801-120345-1024x717.png)
This is a string that comes with the theme, as opposed to a blog post content that is user-generated.
If you go to the backend of your website and inspect your theme’s code, the text string would appear either like this:
<p>Read more</p>
Or like this:
<p><?php _e( 'Read more' ); ?></p>
The former text string is an ordinary code snippet. The latter is wrapped in the gettext localization function.
The first snippet tells WordPress to display the text as it is; meaning, the text will appear as “Read more” even if you changed the site’s default language to Swedish.
The latter code snippet helps WordPress identify “Read more” as an English text and it tells the CMS to change the text string to its equivalent in Swedish when the site’s language is switched to Swedish. That is if a Swedish PO file is available in the theme. But we’ll get to that soon.
So it’s important for themes and plugins to have their text strings wrapped in gettext to make the themes and plugins translation-ready.
What is the POT File
POT file is found inside the theme or plugin folder and it contains default text strings (like Read more, Next page, Add, Remove, etc) in the default language of the theme or plugin (e.g. English).
Using this file, developers and contributors can identify the default strings coming from the theme or plugin and provide translations for them. They rely on the POT file to be able to translate and generate essential language files called PO or MO.
The POT file is basically a template for future translations.
What are PO & MO Files
PO files contain both the original text strings from the POT files as well as the corresponding translated versions for a specific language. In other words, they fill out the template with translations.
MO files contain the same content as the PO files but in machine-readable (WordPress-friendly) format. This file is used by WordPress to display the translated content to users on the front end of the website.
By now you probably understand the importance of the gettext localization function and the POT file in a WordPress theme or plugin.
But what if your theme or plugin does not support translations? What if they are not translation ready?
What if Your Theme or Plugins are Not Translation-Ready?
Fortunately, the TranslatePress plugin can translate both translation-ready and non-translation-ready themes and plugins.
The plugin offers two types of translation methods: automatic and manual translations.
Automatic translation is much faster, but it requires lots of proofreading, while the manual approach can be done by a professional translator from the get-go but it will take a bit more time depending on the site size.
We will show you how everything works in the next section.
How to Translate a WordPress Theme & Plugin
As mentioned earlier, we are going to use the TranslatePress plugin to demonstrate how to translate a WordPress theme or plugin.
Here’s what needs to be done:
Step 1: Install & Activate the TranslatePress Plugin
TranslatePress is one of the best translation plugins out there. With its user-friendly interface and intuitive features, TranslatePress makes the process of translating themes and plugins a breeze.
The plugin not only allows automatic translation of content but also provides the option to manually translate from the front end with the help of a real-time preview of the website.
One of the standout features of TranslatePress is the ability to translate all types of content, from text strings, to images, and even dynamically displayed elements.
TranslatePress has a free and a premium version. The free version offers all the features you need to translate your WordPress themes and plugins into one additional language. But if you need more languages or additional features, you can grab the premium version of TranslatePress.
We will be using the free version for this tutorial. So, to install the plugin on your website, download the free TranslatePress plugin from the WordPress repository.
Open your WordPress dashboard and go to Plugins > Add New and write “TranslatePress” in the search bar. When the plugin appears on the screen, hit the Install Now and Activate buttons, consecutively.
![Installing TranslatePress for WordPress theme translation](https://colorlib.com/wp/wp-content/uploads/sites/2/Screenshot-04-25-2023-14.55.01.png)
Step 2: Choose a Second Language
After activating the plugin, go to Settings > TranslatePress > General > All Languages.
Under All Languages, there is a dropdown menu. From that menu, select the language you want to translate your theme and plugins into and hit the Add button.
Scroll down to the end of the page and hit the Save Changes button to save your settings.
![TranslatePress language settings](https://colorlib.com/wp/wp-content/uploads/sites/2/image-53-20230801-120415.png)
The free TranslatePress plugin allows you to add a single second language to your website. To be able to add more translation languages, you will need the premium plugin.
NOTE: If you can’t find the language of your choice you can always add a custom language by going to Settings > TranslatePress > Advanced > Custom Language. Fill in the details of your custom language and hit the Save Changes button.
![Advanced TranslatePress settings for custom languages](https://colorlib.com/wp/wp-content/uploads/sites/2/image-53-20230801-120418.png)
Now, if your theme or plugins have already been translated to your chosen language (meaning they already have PO and MO files for that language), TranslatePress will fetch those translations for you from the start.
This means that default text, such as “Read more” or “Add to cart” buttons, 404 page content, “Next post” and “Previous post” links will be translated from the get-go.
But what about the rest of the content, the content you input on your site? Or even the themes and plugins that are not translation-ready?
Well, that’s what we’ll tackle in the following sections of this post.
Step 3: Implement Automatic or Manual Translations
We mentioned earlier how TranslatePress offers automatic as well as manual translations. You can use them separately or you can even use them together.
Automatic translations are done through the Google Translate or DeepL APIs, while manual translations can be done by you or a professional translator, using a visual translation editor. But we’ll get back to that in a minute.
It’s worth noting that the manual translation method can also be implemented when you want to correct inaccurate automatic translations.
i. Translate WordPress Theme and Plugins Automatically
Before we dive into the method note that after you enable this feature, automatic translation will be implemented throughout your website.
If you don’t want to automate the translation of your ENTIRE website, then it’s better to implement manual translation which we have covered in the next section.
To enable TranslatePress’ automatic translation, go to Settings > TranslatePress > Automatic Translation. From the dropdown menu adjacent to the Enable Automatic Translation option choose Yes.
![TranslatePress automatic translation settings](https://colorlib.com/wp/wp-content/uploads/sites/2/image-53-20230801-120420.png)
Next, select a translation engine: Google Translate or DeepL.
Translation Engines are machine translation systems that use artificial intelligence to automatically translate text from one language to another.
Both Google Translate and DeepL are powerful translation engines. Google Translation is available for free (for translation of up to 500,000 characters/month), while DeepL requires the premium version of the plugin.
![Choosing between Google Translate and DeepL for automated translation](https://colorlib.com/wp/wp-content/uploads/sites/2/image-53-20230801-120424.png)
Whichever translation engine you choose, you need to fetch an API to connect it with your website. These help docs will assist you in generating a Google Translate API and a DeepL API.
As soon as you add the API and save your changes, automatic translation will be enabled on your website.
As mentioned earlier, automatic translations translate everything on your website including the theme and plugins content. The translations are triggered only when someone visits your site in your secondary language for the first time. The translations are then stored in your own database so you can never lose access to them, even if you choose to disable automatic translation at some point.
NOTE: TranslatePress adds a language switcher to the site so your visitors can easily switch between the languages available on your website and browse it in the one they prefer.
![Ecommerce website translation example with language switching](https://colorlib.com/wp/wp-content/uploads/sites/2/image-53-20230801-120426.png)
ii. Translate WordPress Theme and Plugins Manually
To manually translate your theme and plugins content, open a post or page and select the Translate Page option from the admin bar.
![Frontend translation options for TranslatePress](https://colorlib.com/wp/wp-content/uploads/sites/2/image-53-20230801-120428.png)
You will see the visual translation editor on the left side of the screen and a preview of your site on the right. You will use this editor to manually translate content on your WordPress website.
![Live translation editing using TranslatePress](https://colorlib.com/wp/wp-content/uploads/sites/2/image-53-20230801-120430.png)
Hover your cursor over the piece of content you want to translate and select the pen icon displayed adjacent to the text. The text will appear in the translation editor along with an empty field underneath where you can add the corresponding translated text.
Remember to hit the Save button to save the translation.
![Read time live content translation using TranslatePress WordPress plugin](https://colorlib.com/wp/wp-content/uploads/sites/2/image-53-20230801-120434.png)
You can do the same for all of the content on your site, including images, forms, buttons, and pretty much anything your theme or plugins display on the site.
That’s it. That’s how you can translate a WordPress theme or plugin.
That’s How You Translate Your WordPress Themes and Plugins
Translating a WordPress theme or plugin is a great way to draw more visitors and boost your conversation rates. You typically need your theme and plugin to be translation-ready but a powerful tool like TranslatePress can even translate plugins and themes that aren’t.
Besides translating themes and plugins, you can use TranslatePress to translate the rest of your site content too. You can translate your entire website and even your WooCommerce store.
You can first give it a spin using the free version of the plugin. Then, when you’re ready to take your multilingual site to the next level, you can choose a premium plan and translate even further. You’ll be able to tackle SEO elements, URL slugs, use powerful add-ons, and add unlimited languages. All to widen your website’s reach and grow its international traffic.
This Post Has 0 Comments