Schedule a Free Consultation
Translate Plugin From Child Theme

Translate Plugin From Child Theme

Read Article

Ever needed to translate some strings from a plugin so as to be able to further upgrade the main plugin without loosing your translations?

I did.

This is because there some languages around for which there are no default translations in plugins like WooCommerce Social Login or WooCommerce Bookings.

Unfortunately there’s no standard way to do that (at least I found none), but after some debugging inside WordPress here’s a solution that I would like to share with you:
In order to use this, follow these steps:

  1. Find the text domain of your plugin (look in plugin source code)
  2. Create a /translations folder inside your Theme
  3. Copy the .po file of your plugin to the /translations folder
  4. Rename the .po file and give it the following name: {text_domain}-{locale}.po For example: woocommerce-social-login-ro_RO.po (where woocommerce-social-login is the text domain and ro_RO is the desired locale)
  5. Compile .po file to .mo using a tool like PoEdit That’s it.

Optionally

In case you want to remove from your .po file (in your /translations folder) the untranslated strings so as to only leave there the one that you translated, feel free to use msgattrib gettext tool:

Navigate to

Check some other articles we wrote

Replace comment notification email with Mandrill template
Replace comment notification email with Mandrill template
Have you ever needed to replace the default email that WordPress is sending whenever a new comment is added? Recently I did. Here’s how I did it: To get this going you have to: 1) Install and configure WPMandrill plugin 2) Create a new template in your Mandrill account 3) Paste the php code in your […]
How To Build Long-Lasting Relationships With Your Clients When You Have A WordPress Website
For any business, losing customers can really hurt your bottom line. That’s why smart companies know customer retention is just as important as acquisition. In fact, according to Neil Patel, “Acquiring a new customer can cost up to 7 times more than selling to an existing customer.” As a business owner or marketing decision-maker, you […]
Opening Isotope panel in modal view
We matched Isotope’s innate ability to manage content with the need to display more details in a modal view. The popular Isotope framework for displaying content offers novel ways of arranging elements on a page. Specifically, in this post, we explain how we managed to display the content of table cell under the current table […]