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

Customizing Your WordPress Site: Tailoring Your Brand Identity
Building a distinctive brand identity is crucial for any business wanting to stand out these days. Consumers are becoming more discerning and educated, seeking brands with compatible values and the ability to deliver real value. Fortunately, customizing your WordPress website is one of the best ways to establish and reinforce your brand identity online.  We […]
Multisite Create Page on All Sites
Have you ever worked on a multisite with 60+ sites? For projects of this size the deployment is a challenge in itself because you might need to: regenerate the thumbnails on all the 60 sites; Of course, doing it manually is a no go configure a certain page as homepage on all 60 sites if you […]
Parsing email structure with IMAP functions
Have you ever had to parse the structure of an email, which contains html, text and images? Easier said than done 😅 As a developer, you need to examine the email content, extract images or text, and do something with them, like upload the images to the web server or save them to a database. […]