Home > Docs > WooCommerce PDF Invoices, Packing Slips and Credit Notes Plugin > Translating Plugins Using WPML String Translation

Translating Plugins Using WPML String Translation

Last updated on November 12, 2024

Store owners can translate strings within a WebToffee plugin using the WPML string translation tool and generate documents in different languages. Strings include the general admin texts, document texts, option names, and other texts within the plugin. To translate a string within a plugin, follow the below steps:

  1. Install and activate the WPML string translation tool.
  2. Now, go to WPML > Theme and plugins localization and scroll down to the Strings in the plugins section.
  3. Mark the checkbox next to the WebToffee plugin that you wish to translate and click on the Scan selected plugins for strings button.
  4. Then, go to String Translation under the WPML tab, and select the domain corresponding to the plugin from the ‘In domain‘ dropdown menu.
  5. Click on the ‘+’ icon under the preferred language’s flag and add the translation for the selected string.
  6. Switch the site language to view the translated plugin changes.

Prerequisites

  1. Install and activate the WPML core plugin and WPML string translation add-on.
  2. Install and activate the WebToffee plugin that you wish to translate.
  3. Ensure the required languages are selected in WPML. To know more, refer to this article.

Installing and activating the WPML string translation

To get more details on how to install and activate the WPML string translation tool, refer to this article.

String translation

Below are the detailed steps on how to translate a string within a WebToffee plugin using the string translation tool:

  1. From the WordPress dashboard, navigate to WPML > Theme and plugins localization and scroll down to the Strings in the plugins section.
  2. Now, find the required plugin from the list and check the box next to that plugin name.
  3. Then, scroll down to the bottom of the screen and click on the Scan selected plugins for strings button. This will scan all the strings present in the respective plugin.
Scanning plugin for strings
Scanning a plugin for strings
  1. Go to WPML > String Translation.
  2. In the String translation page, head to the In domain dropdown menu and select the plugin domain. The dropdown lists the domains of all the plugins within your site (For eg. Let’s select the domain corresponding to WebToffee’s free WooCommerce PDF Invoices, Packing Slips, Delivery Notes, and Shipping Labels plugin as shown below).
  1. On selecting the required domain, a list consisting of all the strings present in the respective plugin will show up. Look out for the necessary string using the search option, or simply scroll and navigate to the required string (eg: The below mentioned GIF explains how to search for the string ‘Quantity’).
  1. Upon finding the required string, click on the ‘+’ icon under the desired language’s flag.
  1. Type in the translation in the space provided and save it by pressing the Enter key or by clicking anywhere out of the translation window. Use the Tab key to switch between languages.
Adding translation in the Swedish language
Adding translation in the Swedish language
  1. Similarly, repeat the steps for other strings and languages as well.

After adding the translations, navigate to WPML > Languages and change the default language. Here we have added the translation for ‘Quantity’ in Swedish language. So set Swedish as the default language and generate the invoice document. The invoice document will now contain the Swedish translation of ‘Quantity’ in it which is ‘Kvantitet’.

  1. As a final step, switch the site language to view the translated plugin changes.

Finding missing strings inside a plugin

There can be instances where certain strings in the plugin are not available for translation. To solve this issue, follow these steps:

  1. From the WordPress dashboard, navigate to WPML > String Translation.
  2. Scroll down to the bottom of the page and find the ‘Look for strings while pages are rendered’ option and enable it by marking the checkbox.
Searching the missing strings
Searching the missing strings
  1. Proceed to the WooCommerce Orders page (WooCommerce > Orders) and generate the required document for an order (For e.g. If the missing strings are from the invoice document, generate an invoice for the order). The strings that were missing from that document type will now be added.
  2. Return to the WPML > String translation page, now the missing strings will be added.
  3. Then, add the translations for the newly added strings.
  4. Finally, turn off the ‘Look for strings while pages are rendered’ option.