How to Translate WordPress Plugin

how to translate WordPress plugin
22Jan, 2020

WordPress is the best and most widely used content management system. Among the myriad users of WordPress are millions of non-English users. Almost all WordPress themes and plugins are initially in English. Therefore, many users will find it hard to use them and will need to translate them before using them on their sites.

WordPress solves the problem by allowing you to translate your themes and plugins as you create and manage your website. WordPress doesn’t have inbuilt translation tools. However, the WordPress directory has some excellent translation plugins that make translation incredibly straightforward. In this tutorial, we will only feature the best two tools from the bunch. These are instructions on how to translate WordPress themes and plugins using Poedit and Loco Translate plugin.

Here we will show to translate WordPress Plugins & Theme using

  1. PoEdit
  2. Loto Translate WordPress Plugin

Using POEdit

Poedit is a splendid and popular software for translating themes and plugins. There are available versions for Windows, Mac, and Linux users. It even accommodates RTL languages such as Hebrew and Arabic. Download your appropriate free version on poedit.net and install it on your device. Once you have located the .pot file of the theme or plugin that you want to translate, you can start the translation process. A premium version of Poedit is available for purchase, but the free version works just fine.

Step 1: Open Poedit and select the create new translation option.

Open Poedit

Step 2: A new window will pop up asking you to locate the .pot file of the theme or plugin that you want to translate. Select the file and click on open.

Step 3: A new dropdown menu will appear, asking you to choose the language to which you want to translate your theme or plugin. Make your choice and click ok. In my case, I chose Kenyan Swahili.

Step 4: You will have a window that suggests the strings, which you can translate. You only need to click on any line and enter any translation you like into the translation section. However, if you have the premium version, you can simply click the translation suggestions on the far right of your window. If you do, you’ll get a translation of your entire theme or plugin instead of translating one word or phrase at a time.

Step 5: After completing the translation of your theme or plugin, save the file – preferably in the same directory as the original file. The file you just saved will be in .po format, while Poedit will automatically create a corresponding .mo file.

Step 6: Upload the two files to the matching directory on your hosting account. For themes, the directory resembles this; wp-content/languages/themes/.  On the other hand, plugin directories look like this; wp-content/languages/plugins/.

Step 7: From your WordPress installation files, open the wp-config.php file and add the line; define (‘WPLANG’, ‘Name of the file you saved in step 5’) below the line @package WordPress and above the line; //**MySQL settings – You can get this info from your web host**//.

Or

Go to the settings option below settings on the WordPress dashboard. Below site language, change the language option into the one you just translated your plugin or theme.

Your theme or plugin is now fully translated.

Using Loco Translate Plugin

Unlike Poedit, which is a software for computer operating systems, Loco Translate is a WordPress plugin. Like Poedit, you get it free of charge. This plugin comes in handy with translating themes and plugins. It also offers localization tools, which developers can use to generate templates and extract strings. It has several other amazing features that are worth checking out. Here’s how you can use Loco Translate to translate a theme or plugin.

Step 1: Since it is entirely free, it is available on the WordPress directory of your admin dashboard. To install it, click on add new under plugins on your dashboard.

add plugin

Step 2: Search for Loco Translate in the search box to your right.

search loco translate plugin

Step 3: When you find it, select the install now option and click on activate. Your plugin is ready for use, and it will prompt the appearance of an item labelled Loco Translate on your menu.

Note: Before we proceed, the translation of themes and plugins using Loco Translate is slightly different. Therefore, we will start with the translation of themes. For your theme translation to be successful, you need to make sure that your theme will accommodate the new language. While some themes have many inbuilt languages, some have very few.

Step 4: Click on the general option under Settings on your dashboard. Find the site language option where the default language will be most likely be English.

Step 5: The downward-facing arrow will present a dropdown menu with the installed languages along with those available for installation. Choose the language into which you want to translate your theme. If it is not installed, click on it and choose to save changes. In my case, I chose Swahili (Kiswahili).

Step 6: Go to your dashboard menu and select themes below Loco Translate. Choose your active theme to prompt a window similar to the one below. In my case, my active theme is Astra.

Step 7: Click on the language to prompt a new screen, such as the one below. Note: If there are no translations for your theme, select the new language option.

Step 8: In the dropdown menu below the WordPress language option, click on the language into which you want to translate your theme. Again, I chose Swahili. Here, I advise you to select the custom language to avoid automatic updates. Click on the start translating button. You will notice that the language of your site has changed into the language you chose for your theme.

Step 9: Choose the words you want to translate, and they’ll appear in the original language in the section labelled source text. Next, you should enter the correct translation into the new language in the relevant section. The screen will resemble the one below. If you’re not sure about the accurate translations, try Google translator. After doing the translation, you will notice that the translation is replicated in a section similar to the one below. The star next to the original words indicates that you haven’t saved the changes.

Step 10: Click on the Save icon once you’re done with the translation. After saving, the screen will show the same string translations just like the example below. However, they will appear without the stars beside the original words.

Translate Plugins Using Loco Translate plugin:

Translating plugins is essential as you add textual items to your website. Just like WordPress themes, plugins come with language files that facilitate translation.

Step 1: After installing Loco Translate, go to settings, select the general option, and choose the language you want to translate your plugins into as the primary language of the site. Go to your list of installed plugins and click on the translate option on the one you wish to translate. In my case, I chose the WooCommerce Variation Swatches.

Step 2: This action brings you to a new window, on which you should look for and click on the new language option.

translate plugin

Step 3: From the dropdown menu, choose the language into which you want to translate your plugin.

Select your language

Step 4: Choose a location on this new screen and click the start translating option. It is important to note that, if you don’t select the custom language option, your plugin updates will always affect the language changes you’ve just made.

Step 5: This step is similar to the corresponding one on theme translation. On the next page, click on the strings you want to translate, one after the next. Save your changes and confirm the changes from the frontend of your website.

Final Thoughts

WordPress is easy to use. With Poedit and Loco Translate, translating themes and plugins should be a child’s play. With this tutorial on how to translate WordPress themes and plugins, we hope you’ll need nothing else to get you started. Have fun translating.